Class: FlatKit::LogFormatter

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

Constant Summary collapse

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

Instance Method Summary collapse

Constructor Details

#initializeLogFormatter

Returns a new instance of LogFormatter.



7
8
9
10
# File 'lib/flat_kit/logger.rb', line 7

def initialize
  super
  self.datetime_format = DATETIME_FORMAT
end

Instance Method Details

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



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

def call(severity, time, progname, msg)
  FORMAT % [format_datetime(time.utc), Process.pid, severity, msg2str(msg)]
end