Class: StructuredEventLogger
- Inherits:
-
Object
- Object
- StructuredEventLogger
- Defined in:
- lib/structured_event_logger.rb,
lib/structured_event_logger/version.rb
Defined Under Namespace
Classes: HumanReadableLogger, JsonWriter
Constant Summary collapse
- VERSION =
"0.0.6"
Instance Attribute Summary collapse
-
#default_context ⇒ Object
readonly
Returns the value of attribute default_context.
-
#endpoints ⇒ Object
readonly
Returns the value of attribute endpoints.
Instance Method Summary collapse
- #context ⇒ Object
- #event(scope, event, content = {}) ⇒ Object
-
#initialize(endpoints = {}) ⇒ StructuredEventLogger
constructor
A new instance of StructuredEventLogger.
Constructor Details
#initialize(endpoints = {}) ⇒ StructuredEventLogger
Returns a new instance of StructuredEventLogger.
6 7 8 9 10 11 |
# File 'lib/structured_event_logger.rb', line 6 def initialize(endpoints = {}) @endpoints = endpoints @thread_contexts = {} @default_context = {} end |
Instance Attribute Details
#default_context ⇒ Object (readonly)
Returns the value of attribute default_context.
4 5 6 |
# File 'lib/structured_event_logger.rb', line 4 def default_context @default_context end |
#endpoints ⇒ Object (readonly)
Returns the value of attribute endpoints.
4 5 6 |
# File 'lib/structured_event_logger.rb', line 4 def endpoints @endpoints end |
Instance Method Details
#context ⇒ Object
17 18 19 |
# File 'lib/structured_event_logger.rb', line 17 def context @thread_contexts[thread_key] ||= {} end |
#event(scope, event, content = {}) ⇒ Object
13 14 15 |
# File 'lib/structured_event_logger.rb', line 13 def event(scope, event, content = {}) log_event scope, event, flatten_hash(content) end |