Class: LogSinks::LogEvent
- Inherits:
-
Object
- Object
- LogSinks::LogEvent
- Defined in:
- lib/log_sinks/log_event.rb
Overview
Represents a log event.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#logger_name ⇒ Object
readonly
Returns the value of attribute logger_name.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(timestamp, level, logger_name, msg, meta: nil) ⇒ LogEvent
constructor
A new instance of LogEvent.
Constructor Details
#initialize(timestamp, level, logger_name, msg, meta: nil) ⇒ LogEvent
Returns a new instance of LogEvent.
8 9 10 11 12 13 14 |
# File 'lib/log_sinks/log_event.rb', line 8 def initialize(, level, logger_name, msg, meta: nil) @data = ( || {}).freeze @timestamp = @level = level @logger_name = logger_name @message = msg end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/log_sinks/log_event.rb', line 6 def data @data end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
6 7 8 |
# File 'lib/log_sinks/log_event.rb', line 6 def level @level end |
#logger_name ⇒ Object (readonly)
Returns the value of attribute logger_name.
6 7 8 |
# File 'lib/log_sinks/log_event.rb', line 6 def logger_name @logger_name end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
6 7 8 |
# File 'lib/log_sinks/log_event.rb', line 6 def @message end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
6 7 8 |
# File 'lib/log_sinks/log_event.rb', line 6 def @timestamp end |
Instance Method Details
#[](key) ⇒ Object
16 17 18 |
# File 'lib/log_sinks/log_event.rb', line 16 def [](key) @data[key] end |