Class: CustomFormatter

Inherits:
Logger::Formatter
  • Object
show all
Defined in:
lib/mangopay/util/custom_formatter.rb

Overview

Formatter for log messages

Instance Method Summary collapse

Instance Method Details

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



3
4
5
# File 'lib/mangopay/util/custom_formatter.rb', line 3

def call(severity, time, progname, msg)
  "[#{time}] #{five_chars(severity)} - #{progname}: #{msg2str(msg)}\n"
end

#five_chars(string) ⇒ Object



7
8
9
10
11
# File 'lib/mangopay/util/custom_formatter.rb', line 7

def five_chars(string)
  result = ''
  (5 - string.length).times { result << ' ' }
  result + string
end