Class: Logfoo::LogLine
- Inherits:
-
Struct
- Object
- Struct
- Logfoo::LogLine
- Defined in:
- lib/logfoo/entries.rb
Instance Attribute Summary collapse
-
#level ⇒ Object
Returns the value of attribute level.
-
#logger_name ⇒ Object
Returns the value of attribute logger_name.
-
#message ⇒ Object
Returns the value of attribute message.
-
#payload ⇒ Object
Returns the value of attribute payload.
-
#thread ⇒ Object
Returns the value of attribute thread.
-
#time ⇒ Object
Returns the value of attribute time.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#level ⇒ Object
Returns the value of attribute level
2 3 4 |
# File 'lib/logfoo/entries.rb', line 2 def level @level end |
#logger_name ⇒ Object
Returns the value of attribute logger_name
2 3 4 |
# File 'lib/logfoo/entries.rb', line 2 def logger_name @logger_name end |
#message ⇒ Object
Returns the value of attribute message
2 3 4 |
# File 'lib/logfoo/entries.rb', line 2 def @message end |
#payload ⇒ Object
Returns the value of attribute payload
2 3 4 |
# File 'lib/logfoo/entries.rb', line 2 def payload @payload end |
#thread ⇒ Object
Returns the value of attribute thread
2 3 4 |
# File 'lib/logfoo/entries.rb', line 2 def thread @thread end |
#time ⇒ Object
Returns the value of attribute time
2 3 4 |
# File 'lib/logfoo/entries.rb', line 2 def time @time end |
Class Method Details
.build(logger_name:, message:, payload: nil, level: nil) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/logfoo/entries.rb', line 4 def build(logger_name:, message:, payload: nil, level: nil) self.new( level || :info, Time.now.utc, logger_name, , payload || {}, Thread.current.object_id ) end |
Instance Method Details
#to_h ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/logfoo/entries.rb', line 16 def to_h { level: level, time: time, msg: , logger: logger_name, }.merge!( payload ).merge!( thread: thread ) end |