|
@ -118,24 +118,29 @@ class BasicFormatter < SemanticLogger::Formatters::Color # rubocop:disable Metri |
|
|
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 == 'Rails' && log.message |
|
|
elsif log.name == 'Rails' && log.message |
|
|
log.message = transform_rails_message(log.message) |
|
|
|
|
|
|
|
|
log.message = transform_rails_message(log.message.rstrip) |
|
|
end |
|
|
end |
|
|
log |
|
|
log |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
def transform_rails_message(message) |
|
|
def transform_rails_message(message) |
|
|
message.rstrip! |
|
|
|
|
|
case message |
|
|
case message |
|
|
when /^Completed [23]/ |
|
|
when /^Completed [23]/ |
|
|
"#{message}\n" |
|
|
"#{message}\n" |
|
|
when /^Started/ |
|
|
when /^Started/ |
|
|
md = message.match(/(^Started \w* )"(.*?)"/) |
|
|
|
|
|
"#{md.match(1)}#{ANSI_BOLD}#{md.match(2)}#{ANSI_RESET}" |
|
|
|
|
|
|
|
|
two_captures_last_as_bold(message, /(^Started \w* )"(.*?)"/) |
|
|
|
|
|
when /^Processing/ |
|
|
|
|
|
two_captures_last_as_bold(message, /(^Processing by \w*#\w* as )(.*)/) |
|
|
else |
|
|
else |
|
|
message |
|
|
message |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def two_captures_last_as_bold(message, regex) |
|
|
|
|
|
m1, m2 = message.match(regex).captures |
|
|
|
|
|
"#{m1}#{ANSI_BOLD}#{m2}#{ANSI_RESET}" |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
def transform_action_view_base(log) |
|
|
def transform_action_view_base(log) |
|
|
log.level, message = transform_log_debug_lstrip(log) |
|
|
log.level, message = transform_log_debug_lstrip(log) |
|
|
message = transform_rendered_message_with_filename(message) |
|
|
message = transform_rendered_message_with_filename(message) |
|
|