|
|
@ -23,22 +23,30 @@ class BasicFormatter < SemanticLogger::Formatters::Color |
|
|
|
return unless log.message |
|
|
|
|
|
|
|
msg = log.message |
|
|
|
prefix = "#{color}--#{color_map.clear}" |
|
|
|
prefix = "#{color} #{color_map.clear}" |
|
|
|
|
|
|
|
case log.level |
|
|
|
when :info |
|
|
|
"#{prefix} #{SemanticLogger::AnsiColors::WHITE}#{msg}#{color_map.clear}" |
|
|
|
"#{prefix}#{SemanticLogger::AnsiColors::WHITE}#{msg}#{color_map.clear}" |
|
|
|
when :warn |
|
|
|
"#{prefix} #{ANSI_REVERSED_WARNING}#{msg}#{color_map.clear}" |
|
|
|
"#{prefix}#{ANSI_REVERSED_WARNING}#{msg}#{color_map.clear}" |
|
|
|
when :error |
|
|
|
"#{prefix} #{ANSI_REVERSED_ERROR}#{msg}#{color_map.clear}" |
|
|
|
"#{prefix}#{ANSI_REVERSED_ERROR}#{msg}#{color_map.clear}" |
|
|
|
when :fatal |
|
|
|
"#{prefix} #{ANSI_REVERSED_FATAL}#{msg}#{color_map.clear}" |
|
|
|
"#{prefix}#{ANSI_REVERSED_FATAL}#{msg}#{color_map.clear}" |
|
|
|
else |
|
|
|
"#{prefix} #{color}#{msg}#{color_map.clear}" |
|
|
|
"#{prefix}#{color}#{msg}#{color_map.clear}" |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
def level |
|
|
|
"#{color}╣#{log.level.to_s.chr.upcase}╠#{color_map.clear}" |
|
|
|
end |
|
|
|
|
|
|
|
def name |
|
|
|
"#{color}#{log.name.ljust(20)}#{color_map.clear}" |
|
|
|
end |
|
|
|
|
|
|
|
def process_info |
|
|
|
fname = file_name_and_line |
|
|
|
"#{color}[#{fname}]#{color_map.clear}" if fname |
|
|
@ -64,6 +72,6 @@ class BasicFormatter < SemanticLogger::Formatters::Color |
|
|
|
self.log = log |
|
|
|
self.logger = logger |
|
|
|
|
|
|
|
[level, tags, named_tags, duration, name, message, payload, exception].compact.join(' ') |
|
|
|
[name, level, tags, named_tags, duration, message, payload, exception].compact.join(' ') |
|
|
|
end |
|
|
|
end |