Class: Logtail::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/logtail/event.rb

Overview

Base class for ‘Logtail::Events::*`

Instance Attribute Summary collapse

Instance Method Summary collapse

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, )
  @message = message || ""
  @metadata =  || {}
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



5
6
7
# File 'lib/logtail/event.rb', line 5

def message
  @message
end

#metadataObject (readonly)

Returns the value of attribute metadata.



5
6
7
# File 'lib/logtail/event.rb', line 5

def 
  @metadata
end

Instance Method Details

#inspectObject

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
  message
end

#to_hashObject 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(options = {})
  .to_json(options)
end

#to_msgpack(*args) ⇒ Object



28
29
30
# File 'lib/logtail/event.rb', line 28

def to_msgpack(*args)
  .to_msgpack(*args)
end

#to_sObject



32
33
34
# File 'lib/logtail/event.rb', line 32

def to_s
  message
end