Class: LogSinks::LogEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/log_sinks/log_event.rb

Overview

Represents a log event.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(timestamp, level, logger_name, msg, meta: nil) ⇒ LogEvent

Returns a new instance of LogEvent.



8
9
10
11
12
13
14
# File 'lib/log_sinks/log_event.rb', line 8

def initialize(timestamp, level, logger_name, msg, meta: nil)
  @data = (meta || {}).freeze
  @timestamp = timestamp
  @level = level
  @logger_name = logger_name
  @message = msg
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



6
7
8
# File 'lib/log_sinks/log_event.rb', line 6

def data
  @data
end

#levelObject (readonly)

Returns the value of attribute level.



6
7
8
# File 'lib/log_sinks/log_event.rb', line 6

def level
  @level
end

#logger_nameObject (readonly)

Returns the value of attribute logger_name.



6
7
8
# File 'lib/log_sinks/log_event.rb', line 6

def logger_name
  @logger_name
end

#messageObject (readonly)

Returns the value of attribute message.



6
7
8
# File 'lib/log_sinks/log_event.rb', line 6

def message
  @message
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



6
7
8
# File 'lib/log_sinks/log_event.rb', line 6

def timestamp
  @timestamp
end

Instance Method Details

#[](key) ⇒ Object



16
17
18
# File 'lib/log_sinks/log_event.rb', line 16

def [](key)
  @data[key]
end