Module: Logcraft::LogContextHelper

Included in:
Logcraft, Rails::RequestIdLogger
Defined in:
lib/logcraft/log_context_helper.rb

Instance Method Summary collapse

Instance Method Details

#add_to_log_context(context) ⇒ Object



12
13
14
# File 'lib/logcraft/log_context_helper.rb', line 12

def add_to_log_context(context)
  Logging.mdc.update context
end

#within_log_context(context = {}) ⇒ Object



5
6
7
8
9
10
# File 'lib/logcraft/log_context_helper.rb', line 5

def within_log_context(context = {})
  Logging.mdc.push context
  yield
ensure
  Logging.mdc.pop
end