diff --git a/app/controllers/scores_controller.rb b/app/controllers/scores_controller.rb index f148c26..d9a597a 100644 --- a/app/controllers/scores_controller.rb +++ b/app/controllers/scores_controller.rb @@ -9,7 +9,7 @@ class ScoresController < ApplicationController # logger.info({ one: 1, two: 2 }) # logger.info 'this is an information', { four: 4, five: 5 } # logger.debug BigDecimal('0.0003') - logger.warn 'scores are', @scores + # logger.warn 'scores are', @scores logger.error 'this is an error message' logger.info 'end of normal message' # logger.debug @scores diff --git a/lib/formatters/basic_formatter.rb b/lib/formatters/basic_formatter.rb index e15d599..1b115e8 100644 --- a/lib/formatters/basic_formatter.rb +++ b/lib/formatters/basic_formatter.rb @@ -8,9 +8,10 @@ class BasicFormatter < SemanticLogger::Formatters::Color # rubocop:disable Metri NAME_MAX_SIZE = 25 TERMINAL_PREFIX = ENV['TERMINAL_PREFIX'].to_i || 0 CONTENT_PREFIX = ' '.freeze - PREFIX_RAILS_INTERNAL = '➟ '.freeze - PREFIX_ACTION_INTERNAL = '↪ '.freeze - PREFIX_BUG_INTERNAL = '↪ '.freeze + PREFIX_RAILS_INTERNAL = '⬂ '.freeze + PREFIX_RECORD_INTERNAL = '⬄ '.freeze + PREFIX_ACTION_INTERNAL = '⬃ '.freeze + PREFIX_BUG_INTERNAL = '➟ '.freeze RENDERED_VIEW_DURATION = 100 COMPLETED_DURATION = RENDERED_VIEW_DURATION * 5 @@ -121,6 +122,8 @@ class BasicFormatter < SemanticLogger::Formatters::Color # rubocop:disable Metri def transform_log(log) if log.name == 'ActionView::Base' log = transform_action_view_base(log) + elsif log.name == '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)/ @@ -128,6 +131,11 @@ class BasicFormatter < SemanticLogger::Formatters::Color # rubocop:disable Metri log end + def transform_active_record_message(message) + message = message.lstrip.sub(/^↳ /, 'Fetched by ') + "#{PREFIX_RECORD_INTERNAL}#{message.lstrip}" + end + def transform_rails_message(message) case message when /^Completed/ diff --git a/lib/formatters/symbols.txt b/lib/formatters/symbols.txt index 18c1621..1613cd9 100644 --- a/lib/formatters/symbols.txt +++ b/lib/formatters/symbols.txt @@ -55,7 +55,7 @@ ╙╨╜ ╙─╜ -╣⇰╠ +╣⇰╠⭪⬸⥱⇴⇲⇥⇄⇣ ╣⎇╠ @@ -94,10 +94,10 @@ ⯶ ⵙⵞ⸾ ╣⫫╠ -⫫⫨⮓⮱⮾ +⫫⫨⮓⮱⮾⇤ ⛭ -➾➟ +➾➟⬎ ⤫