Class: MotherBrain::Logging::BasicFormat

Inherits:
Logger::Formatter
  • Object
show all
Defined in:
lib/mb/logging/basic_format.rb

Instance Method Summary collapse

Instance Method Details

#call(severity, datetime, progname, msg) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/mb/logging/basic_format.rb', line 4

def call(severity, datetime, progname, msg)
  message = msg.to_s

  if match = message.match(/NODE\[.+?\]/)
    format_matched_lines match, message
  else
    "[#{datetime.utc.iso8601}] PID[#{Process.pid}] TID[#{Thread.current.object_id.to_s(36)}] #{severity}: #{message}\n"
  end
end