Browse Source

refactor1

pagy
pvincent 10 months ago
parent
commit
f5c5351983
  1. 20
      lib/formatters/basic_formatter.rb

20
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

Loading…
Cancel
Save