Class: LogEasy::Log

Inherits:
Object
  • Object
show all
Defined in:
lib/logeasy/log.rb

Overview

Represents the actual log message. Simply a wrapper for the log information (i.e. level, logger, timestamp, message, etc…).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger, level, message, unformatted = false) ⇒ Log

New log item.

‘logger’ - The logger that received this log message. ‘level’ - The severity of this log. ‘message’ - The message to log. ‘unformatted’ - Optional. Default is false, but if set to true, this log item will not be formatted.



23
24
25
26
27
28
29
# File 'lib/logeasy/log.rb', line 23

def initialize(logger, level, message, unformatted = false)
  @logger = logger
  @level = level
  @message = message
  @timestamp = Time.now
  @unformatted = unformatted
end

Instance Attribute Details

#levelObject

Returns the value of attribute level.



12
13
14
# File 'lib/logeasy/log.rb', line 12

def level
  @level
end

#loggerObject

Returns the value of attribute logger.



11
12
13
# File 'lib/logeasy/log.rb', line 11

def logger
  @logger
end

#messageObject

Returns the value of attribute message.



13
14
15
# File 'lib/logeasy/log.rb', line 13

def message
  @message
end

#timestampObject

Returns the value of attribute timestamp.



14
15
16
# File 'lib/logeasy/log.rb', line 14

def timestamp
  @timestamp
end

#unformattedObject

Returns the value of attribute unformatted.



15
16
17
# File 'lib/logeasy/log.rb', line 15

def unformatted
  @unformatted
end