Module: Sidekiq::Context

Defined in:
lib/sidekiq/logger.rb

Class Method Summary collapse

Class Method Details

.currentObject



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

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

.with(hash) ⇒ Object



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

def self.with(hash)
  orig_context = current.dup
  current.merge!(hash)
  yield
ensure
  Thread.current[:sidekiq_context] = orig_context
end