Class: BBK::Utils::LogFormatter

Inherits:
Logger::Formatter
  • Object
show all
Defined in:
lib/bbk/utils/log_formatter.rb

Constant Summary collapse

FORMAT =
"%5s [%sUTC #%d] (%s)[%s]: %s\n"

Instance Method Summary collapse

Instance Method Details

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



10
11
12
13
# File 'lib/bbk/utils/log_formatter.rb', line 10

def call(severity, time, progname, msg)
  line = msg2str(msg).gsub("\n", '\\n')
  format(FORMAT, severity, format_datetime(time.utc), Process.pid, progname, thread_id, line)
end

#thread_idObject



15
16
17
# File 'lib/bbk/utils/log_formatter.rb', line 15

def thread_id
  [Thread.current.object_id.to_s, Thread.current.name].compact.join('@')
end