module Sidekiq::Context

Public Class Methods

add(k, v) click to toggle source
# File lib/sidekiq/logger.rb, line 20
def self.add(k, v)
  current[k] = v
end
current() click to toggle source
# File lib/sidekiq/logger.rb, line 16
def self.current
  Thread.current[:sidekiq_context] ||= {}
end
with(hash) { || ... } click to toggle source
# 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