Class: Sidecloq::Utils::ContextLogger
- Inherits:
-
Object
- Object
- Sidecloq::Utils::ContextLogger
- Defined in:
- lib/sidecloq/utils.rb
Overview
Sets the Sidekiq::Logging context automatically with direct calls to *.logger
Instance Method Summary collapse
-
#initialize(ctx) ⇒ ContextLogger
constructor
A new instance of ContextLogger.
- #method_missing(meth, *args) ⇒ Object
Constructor Details
#initialize(ctx) ⇒ ContextLogger
Returns a new instance of ContextLogger.
7 8 9 |
# File 'lib/sidecloq/utils.rb', line 7 def initialize(ctx) @context = ctx end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Object
11 12 13 14 15 |
# File 'lib/sidecloq/utils.rb', line 11 def method_missing(meth, *args) Sidekiq::Logging.with_context(@context) do Sidekiq.logger.send(meth, args) end end |