Class: Logtail::Event
- Inherits:
-
Object
- Object
- Logtail::Event
- Defined in:
- lib/logtail/event.rb
Overview
Base class for ‘Logtail::Events::*`
Direct Known Subclasses
Logtail::Events::ControllerCall, Logtail::Events::Error, Logtail::Events::SQLQuery, Logtail::Events::TemplateRender
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
Instance Method Summary collapse
-
#initialize(message, metadata) ⇒ Event
constructor
A new instance of Event.
-
#inspect ⇒ Object
This ensures that Logtail events get logged as messages if they are passed to the standard ::Logger.
- #to_hash ⇒ Object (also: #to_h)
- #to_json(options = {}) ⇒ Object
- #to_msgpack(*args) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(message, metadata) ⇒ Event
Returns a new instance of Event.
6 7 8 9 |
# File 'lib/logtail/event.rb', line 6 def initialize(, ) @message = || "" @metadata = || {} end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
5 6 7 |
# File 'lib/logtail/event.rb', line 5 def @message end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
5 6 7 |
# File 'lib/logtail/event.rb', line 5 def @metadata end |
Instance Method Details
#inspect ⇒ Object
This ensures that Logtail events get logged as messages if they are passed to the standard ::Logger.
See: github.com/ruby/ruby/blob/f6e77b9d3555c1fbaa8aab1cdc0bd6bde95f62c6/lib/logger.rb#L615
15 16 17 |
# File 'lib/logtail/event.rb', line 15 def inspect end |
#to_hash ⇒ Object Also known as: to_h
23 24 25 |
# File 'lib/logtail/event.rb', line 23 def to_hash end |
#to_json(options = {}) ⇒ Object
19 20 21 |
# File 'lib/logtail/event.rb', line 19 def to_json( = {}) .to_json() end |
#to_msgpack(*args) ⇒ Object
28 29 30 |
# File 'lib/logtail/event.rb', line 28 def to_msgpack(*args) .to_msgpack(*args) end |
#to_s ⇒ Object
32 33 34 |
# File 'lib/logtail/event.rb', line 32 def to_s end |