Class: Arcenciel::Logging::DefaultFormater

Inherits:
Object
  • Object
show all
Defined in:
lib/arcenciel/utility/logging.rb

Constant Summary collapse

SEVERITY_CONFIG =
{
  'INFO'  => ['ARC', :blue],
  'WARN'  => ['WARN', :red],
  'ERROR' => ['ERROR', :red],
  'FATAL' => ['FATAL', :red],
  'DEBUG' => ['DEBUG', :blue]
}

Instance Method Summary collapse

Instance Method Details

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



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/arcenciel/utility/logging.rb', line 40

def call(severity, time, progname, msg)
  tag, color = SEVERITY_CONFIG[severity]
  colored_tag = Colored.colorize(tag, foreground: color)

  string = ''
  string += "[#{progname}] " if progname
  string += "[#{colored_tag}] "
  string += msg
  string += "\n"

  string
end