Class: ScoutApm::Logging::Loggers::Swaps::Rails
- Inherits:
-
Object
- Object
- ScoutApm::Logging::Loggers::Swaps::Rails
- Defined in:
- lib/scout_apm/logging/loggers/swaps/rails.rb
Overview
Swaps in our logger for the Rails logger.
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(context) ⇒ Rails
constructor
A new instance of Rails.
- #update_logger! ⇒ Object
Constructor Details
#initialize(context) ⇒ Rails
Returns a new instance of Rails.
15 16 17 |
# File 'lib/scout_apm/logging/loggers/swaps/rails.rb', line 15 def initialize(context) @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
9 10 11 |
# File 'lib/scout_apm/logging/loggers/swaps/rails.rb', line 9 def context @context end |
Class Method Details
Instance Method Details
#update_logger! ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/scout_apm/logging/loggers/swaps/rails.rb', line 19 def update_logger! # In Rails 7.1, broadcast logger was added which allows sinking to multiple IO devices. if defined?(::ActiveSupport::BroadcastLogger) && log_instance.is_a?(::ActiveSupport::BroadcastLogger) context.logger.debug('Rails Broadcast logger detected. Adding new logger to broadcast.') add_logger_to_broadcast! else context.logger.debug("Swapping in Proxy for current Rails logger: #{log_instance.class}.") swap_in_proxy_logger! end new_log_location end |