|
|
@ -2,6 +2,7 @@ require_relative 'wrapper' |
|
|
|
require_relative 'base' |
|
|
|
require 'io/console' |
|
|
|
require 'amazing_print' |
|
|
|
require 'json' |
|
|
|
|
|
|
|
# Opinioned Rails custom formatter |
|
|
|
class BasicFormatter < SemanticLogger::Formatters::Color # rubocop:disable Metrics/ClassLength |
|
|
@ -132,7 +133,7 @@ class BasicFormatter < SemanticLogger::Formatters::Color # rubocop:disable Metri |
|
|
|
end |
|
|
|
|
|
|
|
def transform_active_record_message(message) |
|
|
|
message = message.lstrip.sub(/^↳ /, 'Fetched by ') |
|
|
|
message = message.lstrip.sub(/^↳ /, 'Processed by ') |
|
|
|
"#{PREFIX_RECORD_INTERNAL}#{message.lstrip}" |
|
|
|
end |
|
|
|
|
|
|
@ -145,7 +146,9 @@ class BasicFormatter < SemanticLogger::Formatters::Color # rubocop:disable Metri |
|
|
|
when /^Processing/ |
|
|
|
"#{PREFIX_RAILS_INTERNAL}#{two_captures_last_as_bold(message, /(^Processing by \w*#\w* as )(.*)/)}" |
|
|
|
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 |
|
|
|
message |
|
|
|
end |
|
|
|