Class: HttpStreamingClient::ColoredLogFormatter
- Inherits:
-
Logger::Formatter
- Object
- Logger::Formatter
- HttpStreamingClient::ColoredLogFormatter
- Defined in:
- lib/http_streaming_client/custom_logger.rb
Constant Summary collapse
- SEVERITY_TO_COLOR_MAP =
{'DEBUG'=>'32', 'INFO'=>'0;37', 'WARN'=>'35', 'ERROR'=>'31', 'FATAL'=>'31', 'UNKNOWN'=>'37'}
Instance Method Summary collapse
Instance Method Details
#call(severity, time, progname, msg) ⇒ Object
38 39 40 41 |
# File 'lib/http_streaming_client/custom_logger.rb', line 38 def call(severity, time, progname, msg) color = SEVERITY_TO_COLOR_MAP[severity] "\033[0;37m[%s] \033[#{color}m%5s - %s\033[0m\n" % [time.to_s, severity, msg] end |