|
|
@ -2,16 +2,20 @@ |
|
|
|
class BasicFormatter < SemanticLogger::Formatters::Color |
|
|
|
ANSI_REVERSED_WARNING = "\e[0;30;43m".freeze |
|
|
|
ANSI_REVERSED_ERROR = "\e[1;30;41m".freeze |
|
|
|
ANSI_REVERSED_FATAL = "\e[1;30;45m".freeze |
|
|
|
ANSI_REVERSED_FATAL = "\e[1;30;41m".freeze |
|
|
|
ANSI_GRAY = "\e[90m".freeze |
|
|
|
ANSI_GREEN = SemanticLogger::AnsiColors::GREEN |
|
|
|
ANSI_YELLOW = SemanticLogger::AnsiColors::YELLOW |
|
|
|
ANSI_RED = SemanticLogger::AnsiColors::RED |
|
|
|
ANSI_MAGENTA = SemanticLogger::AnsiColors::MAGENTA |
|
|
|
|
|
|
|
def initialize |
|
|
|
super(time_format: nil, |
|
|
|
color_map: ColorMap.new( |
|
|
|
debug: ANSI_GRAY, |
|
|
|
info: SemanticLogger::AnsiColors::GREEN, |
|
|
|
warn: SemanticLogger::AnsiColors::YELLOW, |
|
|
|
fatal: SemanticLogger::AnsiColors::MAGENTA |
|
|
|
info: ANSI_GREEN, |
|
|
|
warn: ANSI_YELLOW, |
|
|
|
fatal: ANSI_RED |
|
|
|
)) |
|
|
|
end |
|
|
|
|
|
|
@ -49,7 +53,7 @@ class BasicFormatter < SemanticLogger::Formatters::Color |
|
|
|
end |
|
|
|
|
|
|
|
if backtrace.count.positive? |
|
|
|
"-- #{ANSI_REVERSED_ERROR}#{log.exception.class}#{color_map.clear} #{color}#{log.exception.message}#{color_map.clear}#{SemanticLogger::AnsiColors::WHITE}\n\t#{backtrace.join("\n\t")}#{color_map.clear}\n\n" |
|
|
|
"-- #{ANSI_REVERSED_ERROR}#{log.exception.class}#{color_map.clear} #{color}#{log.exception.message}\n#{color} ↳ #{backtrace.join("\n ↳ ")}#{color_map.clear}\n\n" |
|
|
|
else |
|
|
|
"-- #{ANSI_REVERSED_ERROR}#{log.exception.class}: #{log.exception.message}#{color_map.clear}\n\n" |
|
|
|
end |
|
|
|