Module: Sidekiq::Context

Defined in:
lib/sidekiq/logger.rb

Class Method Summary collapse

Class Method Details

.currentObject


15
16
17
# File 'lib/sidekiq/logger.rb', line 15

def self.current
  Thread.current[:sidekiq_context] ||= {}
end

.with(hash) ⇒ Object


8
9
10
11
12
13
# File 'lib/sidekiq/logger.rb', line 8

def self.with(hash)
  current.merge!(hash)
  yield
ensure
  hash.each_key { |key| current.delete(key) }
end