Skip to content

Commit

Permalink
Update the way we attempt to clone Rails logger
Browse files Browse the repository at this point in the history
  • Loading branch information
rsamoilov committed Aug 22, 2024
1 parent 6e94844 commit 5510498
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/rage/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ def call(env)
# clone Rails logger
Rails.configuration.after_initialize do
if Rails.logger && !Rage.logger
rails_logdev = Rails.logger.instance_variable_get(:@logdev)
rails_logdev = Rails.logger.yield_self { |logger|
logger.class.name == "ActiveSupport::BroadcastLogger" ? logger.broadcasts.last : logger
}.instance_variable_get(:@logdev)

Rage.configure do
config.logger = Rage::Logger.new(rails_logdev.dev) if rails_logdev.is_a?(Logger::LogDevice)
end
Expand Down

0 comments on commit 5510498

Please sign in to comment.