Class: MrLogaLoga::LogMessage

Inherits:
Struct
  • Object
show all
Defined in:
lib/mr_loga_loga/log_message.rb

Overview

A structured log message containing the actual message and context

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contextObject

Returns the value of attribute context

Returns:

  • (Object)

    the current value of context



7
8
9
# File 'lib/mr_loga_loga/log_message.rb', line 7

def context
  @context
end

#msgObject

Returns the value of attribute msg

Returns:

  • (Object)

    the current value of msg



7
8
9
# File 'lib/mr_loga_loga/log_message.rb', line 7

def msg
  @msg
end

Instance Method Details

#inspectObject

Format the log message. This is a fallback for logger exctending MrLogaLoga who do not know how to format LogMessage themselves.



10
11
12
13
# File 'lib/mr_loga_loga/log_message.rb', line 10

def inspect
  # This is identical to ActiveRecord::SimpleFormatter
  "#{msg.is_a?(String) ? msg : msg.inspect}\n"
end