Class: FlatKit::LogFormatter

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

Overview

Internal: Log formatting class for FlatKit

Constant Summary collapse

FORMAT =
"%s %5d %05s : %s\n"
DATETIME_FORMAT =
"%Y-%m-%dT%H:%M:%SZ"

Instance Method Summary collapse

Constructor Details

#initializeLogFormatter

Returns a new instance of LogFormatter.



11
12
13
14
# File 'lib/flat_kit/log_formatter.rb', line 11

def initialize
  super
  self.datetime_format = DATETIME_FORMAT
end

Instance Method Details

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



16
17
18
# File 'lib/flat_kit/log_formatter.rb', line 16

def call(severity, time, _progname, msg)
  format(FORMAT, format_datetime(time.utc), Process.pid, severity, msg2str(msg))
end