From 39569b15ee152d648eb66394701b147509c38471 Mon Sep 17 00:00:00 2001 From: pvincent Date: Tue, 23 Jan 2024 20:17:18 +0400 Subject: [PATCH] parameters ruby19_syntax: true --- lib/formatters/basic_formatter.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/formatters/basic_formatter.rb b/lib/formatters/basic_formatter.rb index 1b115e8..52aa33e 100644 --- a/lib/formatters/basic_formatter.rb +++ b/lib/formatters/basic_formatter.rb @@ -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