Browse Source

silence_logger

main
pvincent 2 years ago
parent
commit
3c2aa2b119
  1. 2
      config/initializers/silence_logger.rb
  2. 6
      lib/formatters/basic_formatter.rb

2
config/initializers/silence_logger.rb

@ -0,0 +1,2 @@
Rails.logger.level = :info
ActionView::Base.logger.level = :info

6
lib/formatters/basic_formatter.rb

@ -30,7 +30,11 @@ class BasicFormatter < SemanticLogger::Formatters::Color
else
log.message
end
"#{prefix} #{SemanticLogger::AnsiColors::WHITE}#{message}#{color_map.clear}"
if log.name == "Rails" || log.name == "ActionView::Base"
"#{prefix} #{color}#{message}#{color_map.clear}"
else
"#{prefix} #{SemanticLogger::AnsiColors::WHITE}#{message}#{color_map.clear}"
end
when :warn
"#{prefix} #{ANSI_REVERSED_WARNING}#{log.message}#{color_map.clear}"
when :error, :fatal

Loading…
Cancel
Save