Class: Loops::Logger::LoggerImplementation::Formatter
- Inherits:
-
Object
- Object
- Loops::Logger::LoggerImplementation::Formatter
- Defined in:
- lib/loops/logger.rb
Instance Method Summary collapse
- #call(severity, time, progname, message) ⇒ Object
-
#initialize(logger) ⇒ Formatter
constructor
A new instance of Formatter.
Constructor Details
#initialize(logger) ⇒ Formatter
Returns a new instance of Formatter.
156 157 158 |
# File 'lib/loops/logger.rb', line 156 def initialize(logger) @logger = logger end |
Instance Method Details
#call(severity, time, progname, message) ⇒ Object
160 161 162 163 164 165 166 |
# File 'lib/loops/logger.rb', line 160 def call(severity, time, progname, ) if (@logger.prefix || '').empty? "#{severity[0..0]} : #{time.strftime('%Y-%m-%d %H:%M:%S')} : #{ || progname}\n" else "#{severity[0..0]} : #{time.strftime('%Y-%m-%d %H:%M:%S')} : #{@logger.prefix} : #{ || progname}\n" end end |