|
@ -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/ |
|
|