Module: Epilog::ContextFormatter

Included in:
Formatter
Defined in:
lib/epilog/context_logging.rb

Instance Method Summary collapse

Instance Method Details

#contextObject



22
23
24
25
26
27
28
# File 'lib/epilog/context_logging.rb', line 22

def context
  Thread.current[current_context_key] ||= begin
    result = {}
    context_stack.each { |frame| result.merge!(frame) }
    result
  end.freeze
end

#pop_contextObject



35
36
37
38
# File 'lib/epilog/context_logging.rb', line 35

def pop_context
  clear_context
  context_stack.pop
end

#push_context(frame) ⇒ Object



30
31
32
33
# File 'lib/epilog/context_logging.rb', line 30

def push_context(frame)
  clear_context
  context_stack.push(frame)
end