diff --git a/lib/formatters/basic_formatter.rb b/lib/formatters/basic_formatter.rb index 52aa33e..4e66e00 100644 --- a/lib/formatters/basic_formatter.rb +++ b/lib/formatters/basic_formatter.rb @@ -121,14 +121,20 @@ class BasicFormatter < SemanticLogger::Formatters::Color # rubocop:disable Metri # transform log before display def transform_log(log) - if log.name == 'ActionView::Base' - log = transform_action_view_base(log) - elsif log.name == 'ActiveRecord::Base' + case log.name + when 'ActionView::Base' then transform_action_view_base(log) + when 'Rails' then transform_rails_log(log) + when 'ActiveRecord::Base' log.message = transform_active_record_message(log.message) - elsif log.name == 'Rails' && log.message - log.message = transform_rails_message(log.message.rstrip) - log.level = :debug if log.message =~ /^#{PREFIX_RAILS_INTERNAL}(Processing|Parameters)/ - end + log + else log end + end + + def transform_rails_log(log) + return log unless log.message + + log.message = transform_rails_message(log.message.rstrip) + log.level = :debug if log.message =~ /^#{PREFIX_RAILS_INTERNAL}(Processing|Parameters)/ log end