Class: Helpers::ColorFormatter
- Inherits:
-
Logger::Formatter
- Object
- Logger::Formatter
- Helpers::ColorFormatter
- Defined in:
- lib/helpers/color_formatter.rb
Overview
colorful log formatter, also logs thread object id instead of process id
Constant Summary collapse
- SCHEMA =
%w(nothing green yellow red purple cyan)
Instance Method Summary collapse
Instance Method Details
#call(severity, time, progname, msg) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/helpers/color_formatter.rb', line 10 def call(severity, time, progname, msg) level = ::Logger::Severity.const_get(severity) color = SCHEMA[level] text = Format % [severity[0..0], format_datetime(time), Thread.current.object_id, severity, progname, msg2str(msg)] color ? Colorize.colorize(color, text) : text end |