class Logtail::Event

Base class for `Logtail::Events::*` @private

Attributes

message[R]
metadata[R]

Public Class Methods

new(message, metadata) click to toggle source
# File lib/logtail/event.rb, line 6
def initialize(message, metadata)
  @message = message || ""
  @metadata = metadata || {}
end

Public Instance Methods

inspect() click to toggle source

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

# File lib/logtail/event.rb, line 15
def inspect
  message
end
to_h()
Alias for: to_hash
to_hash() click to toggle source
# File lib/logtail/event.rb, line 23
def to_hash
  metadata
end
Also aliased as: to_h
to_json(options = {}) click to toggle source
# File lib/logtail/event.rb, line 19
def to_json(options = {})
  metadata.to_json(options)
end
to_msgpack(*args) click to toggle source
# File lib/logtail/event.rb, line 28
def to_msgpack(*args)
  metadata.to_msgpack(*args)
end
to_s() click to toggle source
# File lib/logtail/event.rb, line 32
def to_s
  message
end