Class: MrLogaLoga::Formatters::KeyValue
- Inherits:
-
Logger::Formatter
- Object
- Logger::Formatter
- MrLogaLoga::Formatters::KeyValue
- Defined in:
- lib/mr_loga_loga/formatters/key_value.rb
Overview
Description
A simple key value formatter that extends the standard formatter by rendering additional contextual information.
Format
The key-value formatter renders messages into the following format:
Log format:
SeverityID, [DateTime #pid] SeverityLabel -- ProgName: message key1=value1 key2=value2
Instance Method Summary collapse
-
#call(severity, datetime, progname, message, **context) ⇒ String
Render a log message.
Instance Method Details
#call(severity, datetime, progname, message, **context) ⇒ String
Render a log message
27 28 29 30 31 32 33 |
# File 'lib/mr_loga_loga/formatters/key_value.rb', line 27 def call(severity, datetime, progname, , **context) = context.map { |key, value| "#{key}=#{value}" } .prepend() .compact .join(' ') super(severity, datetime, progname, ) end |