|
@ -23,22 +23,30 @@ class BasicFormatter < SemanticLogger::Formatters::Color |
|
|
return unless log.message |
|
|
return unless log.message |
|
|
|
|
|
|
|
|
msg = log.message |
|
|
msg = log.message |
|
|
prefix = "#{color}--#{color_map.clear}" |
|
|
|
|
|
|
|
|
prefix = "#{color} #{color_map.clear}" |
|
|
|
|
|
|
|
|
case log.level |
|
|
case log.level |
|
|
when :info |
|
|
when :info |
|
|
"#{prefix} #{SemanticLogger::AnsiColors::WHITE}#{msg}#{color_map.clear}" |
|
|
|
|
|
|
|
|
"#{prefix}#{SemanticLogger::AnsiColors::WHITE}#{msg}#{color_map.clear}" |
|
|
when :warn |
|
|
when :warn |
|
|
"#{prefix} #{ANSI_REVERSED_WARNING}#{msg}#{color_map.clear}" |
|
|
|
|
|
|
|
|
"#{prefix}#{ANSI_REVERSED_WARNING}#{msg}#{color_map.clear}" |
|
|
when :error |
|
|
when :error |
|
|
"#{prefix} #{ANSI_REVERSED_ERROR}#{msg}#{color_map.clear}" |
|
|
|
|
|
|
|
|
"#{prefix}#{ANSI_REVERSED_ERROR}#{msg}#{color_map.clear}" |
|
|
when :fatal |
|
|
when :fatal |
|
|
"#{prefix} #{ANSI_REVERSED_FATAL}#{msg}#{color_map.clear}" |
|
|
|
|
|
|
|
|
"#{prefix}#{ANSI_REVERSED_FATAL}#{msg}#{color_map.clear}" |
|
|
else |
|
|
else |
|
|
"#{prefix} #{color}#{msg}#{color_map.clear}" |
|
|
|
|
|
|
|
|
"#{prefix}#{color}#{msg}#{color_map.clear}" |
|
|
end |
|
|
end |
|
|
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 |
|
|
def process_info |
|
|
fname = file_name_and_line |
|
|
fname = file_name_and_line |
|
|
"#{color}[#{fname}]#{color_map.clear}" if fname |
|
|
"#{color}[#{fname}]#{color_map.clear}" if fname |
|
@ -64,6 +72,6 @@ class BasicFormatter < SemanticLogger::Formatters::Color |
|
|
self.log = log |
|
|
self.log = log |
|
|
self.logger = logger |
|
|
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 |
|
|
end |
|
|
end |