Method: WCC::LogFormatter#call

Defined in:
lib/wcc.rb

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



335
336
337
338
339
340
341
342
343
# File 'lib/wcc.rb', line 335

def call(lvl, time, progname, msg)
  text = "%s: %s" % [lvl, msg.to_s]
  if @color
    return [magenta, text, rst, "\n"].join if lvl == "FATAL"
    return [red, text, rst, "\n"].join if lvl == "ERROR"
    return [yellow, text, rst, "\n"].join if lvl == "WARN"
  end
  [text, "\n"].join
end