Browse Source

parameters ruby19_syntax: true

pagy
pvincent 10 months ago
parent
commit
39569b15ee
  1. 7
      lib/formatters/basic_formatter.rb

7
lib/formatters/basic_formatter.rb

@ -2,6 +2,7 @@ require_relative 'wrapper'
require_relative 'base' require_relative 'base'
require 'io/console' require 'io/console'
require 'amazing_print' require 'amazing_print'
require 'json'
# Opinioned Rails custom formatter # Opinioned Rails custom formatter
class BasicFormatter < SemanticLogger::Formatters::Color # rubocop:disable Metrics/ClassLength class BasicFormatter < SemanticLogger::Formatters::Color # rubocop:disable Metrics/ClassLength
@ -132,7 +133,7 @@ class BasicFormatter < SemanticLogger::Formatters::Color # rubocop:disable Metri
end end
def transform_active_record_message(message) def transform_active_record_message(message)
message = message.lstrip.sub(/^↳ /, 'Fetched by ')
message = message.lstrip.sub(/^↳ /, 'Processed by ')
"#{PREFIX_RECORD_INTERNAL}#{message.lstrip}" "#{PREFIX_RECORD_INTERNAL}#{message.lstrip}"
end end
@ -145,7 +146,9 @@ class BasicFormatter < SemanticLogger::Formatters::Color # rubocop:disable Metri
when /^Processing/ when /^Processing/
"#{PREFIX_RAILS_INTERNAL}#{two_captures_last_as_bold(message, /(^Processing by \w*#\w* as )(.*)/)}" "#{PREFIX_RAILS_INTERNAL}#{two_captures_last_as_bold(message, /(^Processing by \w*#\w* as )(.*)/)}"
when / Parameters/ when / Parameters/
"#{PREFIX_RAILS_INTERNAL}#{message.lstrip}"
parameters = message.lstrip.match(/Parameters: ({.*}$)/).match(1)
parameters = JSON.parse(parameters.gsub('=>', ':'), symbolize_names: true)
"#{PREFIX_RAILS_INTERNAL}Parameters: #{parameters.ai(ruby19_syntax: true, plain: true, multiline: false)}"
else else
message message
end end

Loading…
Cancel
Save