Browse Source

final arrows

pagy
pvincent 10 months ago
parent
commit
3bdbf9e2aa
  1. 2
      app/controllers/scores_controller.rb
  2. 14
      lib/formatters/basic_formatter.rb
  3. 6
      lib/formatters/symbols.txt

2
app/controllers/scores_controller.rb

@ -9,7 +9,7 @@ class ScoresController < ApplicationController
# logger.info({ one: 1, two: 2 }) # logger.info({ one: 1, two: 2 })
# logger.info 'this is an information', { four: 4, five: 5 } # logger.info 'this is an information', { four: 4, five: 5 }
# logger.debug BigDecimal('0.0003') # logger.debug BigDecimal('0.0003')
logger.warn 'scores are', @scores
# logger.warn 'scores are', @scores
logger.error 'this is an error message' logger.error 'this is an error message'
logger.info 'end of normal message' logger.info 'end of normal message'
# logger.debug @scores # logger.debug @scores

14
lib/formatters/basic_formatter.rb

@ -8,9 +8,10 @@ class BasicFormatter < SemanticLogger::Formatters::Color # rubocop:disable Metri
NAME_MAX_SIZE = 25 NAME_MAX_SIZE = 25
TERMINAL_PREFIX = ENV['TERMINAL_PREFIX'].to_i || 0 TERMINAL_PREFIX = ENV['TERMINAL_PREFIX'].to_i || 0
CONTENT_PREFIX = ' '.freeze 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 RENDERED_VIEW_DURATION = 100
COMPLETED_DURATION = RENDERED_VIEW_DURATION * 5 COMPLETED_DURATION = RENDERED_VIEW_DURATION * 5
@ -121,6 +122,8 @@ class BasicFormatter < SemanticLogger::Formatters::Color # rubocop:disable Metri
def transform_log(log) def transform_log(log)
if log.name == 'ActionView::Base' if log.name == 'ActionView::Base'
log = transform_action_view_base(log) 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 elsif log.name == 'Rails' && log.message
log.message = transform_rails_message(log.message.rstrip) log.message = transform_rails_message(log.message.rstrip)
log.level = :debug if log.message =~ /^#{PREFIX_RAILS_INTERNAL}(Processing|Parameters)/ log.level = :debug if log.message =~ /^#{PREFIX_RAILS_INTERNAL}(Processing|Parameters)/
@ -128,6 +131,11 @@ class BasicFormatter < SemanticLogger::Formatters::Color # rubocop:disable Metri
log log
end end
def transform_active_record_message(message)
message = message.lstrip.sub(/^↳ /, 'Fetched by ')
"#{PREFIX_RECORD_INTERNAL}#{message.lstrip}"
end
def transform_rails_message(message) def transform_rails_message(message)
case message case message
when /^Completed/ when /^Completed/

6
lib/formatters/symbols.txt

@ -55,7 +55,7 @@
╙╨╜ ╙╨╜
╙─╜ ╙─╜
╣⇰╠
╣⇰╠⭪⬸⥱⇴⇲⇥⇄⇣
╣⎇╠ ╣⎇╠
@ -94,10 +94,10 @@
ⵙⵞ⸾ ⵙⵞ⸾
╣⫫╠ ╣⫫╠
⫫⫨⮓⮱⮾
⫫⫨⮓⮱⮾
➾➟
➾➟

Loading…
Cancel
Save