Class: Logger::Formatter

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

Instance Method Summary collapse

Instance Method Details

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



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/whatup/server/logger.rb', line 10

def call severity, time, _progname, msg
  color = case severity
          when 'DEBUG' then :light_magenta
          when 'INFO' then :light_green
          when 'WARN' then :light_cyan
          when 'ERROR' then :light_red
          when 'FATAL', 'UNKNOWN' then :red
          end

  "[#{severity.ljust(5, ' ').colorize color}][#{time}]: #{msg}\n"
end