Class: Logfoo::ExceptionEntry
- Inherits:
-
Struct
- Object
- Struct
- Logfoo::ExceptionEntry
- Defined in:
- lib/logfoo/entry.rb
Instance Attribute Summary collapse
-
#exception ⇒ Object
Returns the value of attribute exception.
-
#level ⇒ Object
Returns the value of attribute level.
-
#payload ⇒ Object
Returns the value of attribute payload.
-
#scope ⇒ Object
Returns the value of attribute scope.
-
#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
17 18 19 |
# File 'lib/logfoo/entry.rb', line 17 def exception @exception end |
#level ⇒ Object
Returns the value of attribute level
17 18 19 |
# File 'lib/logfoo/entry.rb', line 17 def level @level end |
#payload ⇒ Object
Returns the value of attribute payload
17 18 19 |
# File 'lib/logfoo/entry.rb', line 17 def payload @payload end |
#scope ⇒ Object
Returns the value of attribute scope
17 18 19 |
# File 'lib/logfoo/entry.rb', line 17 def scope @scope end |
#thread ⇒ Object
Returns the value of attribute thread
17 18 19 |
# File 'lib/logfoo/entry.rb', line 17 def thread @thread end |
#time ⇒ Object
Returns the value of attribute time
17 18 19 |
# File 'lib/logfoo/entry.rb', line 17 def time @time end |
Class Method Details
.build(scope, ex, payload = nil, options = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/logfoo/entry.rb', line 19 def build(scope, ex, payload = nil, = {}) self.new( [:level], Time.now, scope, ex, payload, Thread.current.object_id ) end |
Instance Method Details
#to_h ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/logfoo/entry.rb', line 31 def to_h { level: level || :error, time: time || Time.now, msg: exception., scope: scope, err: exception.class.to_s, }.merge!( payload || {} ).merge!( thread: thread ) end |