Module: Dlog::Formatter

Defined in:
lib/dlog.rb

Overview

Logging formatter

Class Method Summary collapse

Class Method Details

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

formatter#call is invoked with 4 arguments: severity, time, progname and msg for each log. Bear in mind that time is a Time and msg is an Object that user passed and it could not be a String.



85
86
87
# File 'lib/dlog.rb', line 85

def self.call(severity, time, progname, msg)
  time.strftime("%Y-%m-%d %H:%M:%S #{severity}: #{msg}")
end