Browse Source

rails formatter

pagy
pvincent 9 months ago
parent
commit
ce1a464426
  1. 12
      lib/formatters/basic_formatter.rb

12
lib/formatters/basic_formatter.rb

@ -23,7 +23,7 @@ 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
@ -39,6 +39,14 @@ class BasicFormatter < SemanticLogger::Formatters::Color
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
Loading…
Cancel
Save