Class: Jinx::MultilineLogger

Inherits:
Logger
  • Object
show all
Defined in:
lib/jinx/helpers/log.rb

Overview

Extends the standard Logger to format multi-line messages on separate lines.

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ MultilineLogger

Returns a new instance of MultilineLogger.

See Also:

  • Logger#initialize


25
26
27
# File 'lib/jinx/helpers/log.rb', line 25

def initialize(*args)
  super
end

Instance Method Details

#format_message(severity, datetime, progname, msg) ⇒ Object (private)

Writes msg to the log device. Each line in msg is formatted separately.



39
40
41
42
43
44
45
# File 'lib/jinx/helpers/log.rb', line 39

def format_message(severity, datetime, progname, msg)
  if String === msg then
    msg.inject('') { |s, line| s << super(severity, datetime, progname, line.chomp) }
  else
    super
  end
end