class Lumberjack::Context
A context is used to store tags that are then added to all log entries within a block.
def [](key)
-
(Object)
- The tag value.
Parameters:
-
key
(String, Symbol
) -- The tag key.
def [](key) @tags[key.to_s] end
def []=(key, value)
-
(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)
-
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
-
(void)
-
def reset @tags.clear end
def tag(tags)
-
(void)
-
Parameters:
-
tags
(Hash
) -- The tags to set.
def tag(tags) tags.each do |key, value| @tags[key.to_s] = value end end