Class: Klogger::Formatters::Simple

Inherits:
Abstract
  • Object
show all
Defined in:
lib/klogger/formatters/simple.rb

Instance Method Summary collapse

Methods inherited from Abstract

#initialize

Constructor Details

This class inherits a constructor from Klogger::Abstract

Instance Method Details

#call(_severity, _time, _progname, payload) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/klogger/formatters/simple.rb', line 9

def call(_severity, _time, _progname, payload)
  string = String.new
  payload.each do |key, value|
    string << ' ' if string.length.positive?
    string << "#{colorize(key.to_s + ':', payload[:severity].to_sym)} #{sanitize_value(value)}"
  end
  string + "\n"
end