Class: Loops::Logger::LoggerImplementation::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/loops/logger.rb

Instance Method Summary collapse

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, message)
  if (@logger.prefix || '').empty?
    "#{severity[0..0]} : #{time.strftime('%Y-%m-%d %H:%M:%S')} : #{message || progname}\n"
  else
    "#{severity[0..0]} : #{time.strftime('%Y-%m-%d %H:%M:%S')} : #{@logger.prefix} : #{message || progname}\n"
  end
end