class Lumberjack::Context

A context is used to store tags that are then added to all log entries within a block.

def [](key)

Returns:
  • (Object) - The tag value.

Parameters:
  • key (String, Symbol) -- The tag key.
def [](key)
  @tags[key.to_s]
end

def []=(key, value)

Returns:
  • (void) -

Parameters:
  • value (Object) -- The tag value.
  • key (String, Symbol) -- The tag key.
def []=(key, value)
  @tags[key.to_s] = value
end

def initialize(parent_context = nil)

Parameters:
  • parent_context (Context) -- A parent context to inherit tags from.
def initialize(parent_context = nil)
  @tags = {}
  @tags.merge!(parent_context.tags) if parent_context
end

def reset

Returns:
  • (void) -
def reset
  @tags.clear
end

def tag(tags)

Returns:
  • (void) -

Parameters:
  • tags (Hash) -- The tags to set.
def tag(tags)
  tags.each do |key, value|
    @tags[key.to_s] = value
  end
end