Class: Logtail::Events::Error
- Inherits:
-
Logtail::Event
- Object
- Logtail::Event
- Logtail::Events::Error
- Defined in:
- lib/logtail/events/error.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#backtrace_json ⇒ Object
readonly
Returns the value of attribute backtrace_json.
-
#error_message ⇒ Object
readonly
Returns the value of attribute error_message.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Logtail::Event
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Error
constructor
A new instance of Error.
- #message ⇒ Object
- #to_hash ⇒ Object
Methods inherited from Logtail::Event
#inspect, #to_json, #to_msgpack, #to_s
Constructor Details
#initialize(attributes) ⇒ Error
Returns a new instance of Error.
10 11 12 13 14 15 16 17 |
# File 'lib/logtail/events/error.rb', line 10 def initialize(attributes) @name = attributes[:name] @error_message = attributes[:error_message] if attributes[:backtrace] @backtrace_json = attributes[:backtrace].to_json end end |
Instance Attribute Details
#backtrace_json ⇒ Object (readonly)
Returns the value of attribute backtrace_json.
8 9 10 |
# File 'lib/logtail/events/error.rb', line 8 def backtrace_json @backtrace_json end |
#error_message ⇒ Object (readonly)
Returns the value of attribute error_message.
8 9 10 |
# File 'lib/logtail/events/error.rb', line 8 def @error_message end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/logtail/events/error.rb', line 8 def name @name end |
Instance Method Details
#message ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/logtail/events/error.rb', line 19 def = "#{name}" if !.nil? << " (#{})" end end |
#to_hash ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/logtail/events/error.rb', line 29 def to_hash { error: { name: name, message: , backtrace_json: backtrace_json } } end |