Class: Logfoo::ErrLine
- Inherits:
-
Struct
- Object
- Struct
- Logfoo::ErrLine
- Defined in:
- lib/logfoo/entries.rb
Instance Attribute Summary collapse
-
#exception ⇒ Object
Returns the value of attribute exception.
-
#level ⇒ Object
Returns the value of attribute level.
-
#logger_name ⇒ Object
Returns the value of attribute logger_name.
-
#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
#exception ⇒ Object
Returns the value of attribute exception
30 31 32 |
# File 'lib/logfoo/entries.rb', line 30 def exception @exception end |
#level ⇒ Object
Returns the value of attribute level
30 31 32 |
# File 'lib/logfoo/entries.rb', line 30 def level @level end |
#logger_name ⇒ Object
Returns the value of attribute logger_name
30 31 32 |
# File 'lib/logfoo/entries.rb', line 30 def logger_name @logger_name end |
#payload ⇒ Object
Returns the value of attribute payload
30 31 32 |
# File 'lib/logfoo/entries.rb', line 30 def payload @payload end |
#thread ⇒ Object
Returns the value of attribute thread
30 31 32 |
# File 'lib/logfoo/entries.rb', line 30 def thread @thread end |
#time ⇒ Object
Returns the value of attribute time
30 31 32 |
# File 'lib/logfoo/entries.rb', line 30 def time @time end |
Class Method Details
.build(logger_name:, exception:, payload: nil, level: nil) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/logfoo/entries.rb', line 32 def build(logger_name:, exception:, payload: nil, level: nil) self.new( level || :error, Time.now.utc, logger_name, exception, payload || {}, Thread.current.object_id ) end |
Instance Method Details
#to_h ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/logfoo/entries.rb', line 44 def to_h { level: level, time: time, msg: exception., logger: logger_name, err: exception.class.to_s, }.merge!( payload ).merge!( thread: thread, stacktrace: exception.backtrace, ) end |