Skip to content

Commit

Permalink
Fix broadcast logging in rails 7.1+
Browse files Browse the repository at this point in the history
  • Loading branch information
iuri-gg committed Oct 15, 2023
1 parent 5a5758c commit d6c4f4a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

- Add `batch_broadcasts` option to automatically batch broadcasts for code wrapped in Rails executor. ([@palkan][])

- Fix broadcast logging in Rails 7.1. ([@iuri-gg][])

## 1.4.1 (2023-09-27)

- Fix compatibility with Rails 7.1. ([@palkan][])
Expand Down
4 changes: 2 additions & 2 deletions lib/anycable/rails/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class Railtie < ::Rails::Railtie # :nodoc:
console.level = ::Rails.logger.level if ::Rails.logger.respond_to?(:level)

# Rails 7.1+
if defined?(ActiveSupport::BroadcastLogger)
AnyCable.logger = ActiveSupport::BroadcastLogger.new(AnyCable.logger, console)
if AnyCable.logger.respond_to?(:broadcast_to)
AnyCable.logger.broadcast_to(console)
else
AnyCable.logger.extend(ActiveSupport::Logger.broadcast(console))
end
Expand Down

0 comments on commit d6c4f4a

Please sign in to comment.