|
|
@ -3,6 +3,7 @@ require 'rainbow' |
|
|
|
# ColoredFormatter outputs colored message according to severity |
|
|
|
class ColoredFormatter < Logger::Formatter |
|
|
|
def call(severity, _time, _program_name, message) # rubocop:disable Metrics/MethodLength |
|
|
|
msg = message.is_a?(String) ? message : message.inspect |
|
|
|
tint = case severity |
|
|
|
when 'DEBUG' |
|
|
|
:darkgray |
|
|
@ -18,6 +19,6 @@ class ColoredFormatter < Logger::Formatter |
|
|
|
else |
|
|
|
raise "unknown severity #{severity}" |
|
|
|
end |
|
|
|
"#{Rainbow('╞' + severity.ljust(5) + '╡').bg(:cyan).color(:darkgray)}╠ #{Rainbow(message).color(tint)}\n" |
|
|
|
"#{Rainbow('╞' + severity.ljust(5) + '╡').bg(:cyan).color(:darkgray)}╠ #{Rainbow(msg).color(tint)}\n" |
|
|
|
end |
|
|
|
end |