Module: UU::LogContext

Included in:
Log
Defined in:
lib/uu/log_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contextObject



9
10
11
# File 'lib/uu/log_context.rb', line 9

def context
  @context ||= {}
end

Instance Method Details

#append_context(context_) ⇒ Object



13
14
15
# File 'lib/uu/log_context.rb', line 13

def append_context(context_)
  self.context = context.merge(context_)
end

#with(context_) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/uu/log_context.rb', line 17

def with(context_)
  original_context = context
  self.context = context.merge(context_)
  yield
ensure
  self.context = original_context
end