|
|
@ -119,7 +119,7 @@ class AnsiFormatter < SemanticLogger::Formatters::Color |
|
|
|
log.level = :debug |
|
|
|
log.message.lstrip! |
|
|
|
if log.name == 'ActiveRecord::Base' |
|
|
|
unbold(log.message) |
|
|
|
unbold!(log.message) |
|
|
|
|
|
|
|
if log.message.starts_with?('↳ ') |
|
|
|
log.message = AnsiCommon.ansi_trace(log.message, '⇄') |
|
|
@ -130,8 +130,10 @@ class AnsiFormatter < SemanticLogger::Formatters::Color |
|
|
|
sql_type, sql_entry = sql_command.split("\e[0m") |
|
|
|
sql_color_entry = sql_entry.match(AnsiCommon::ANSI_REGEX).to_s |
|
|
|
sql_args = JSON.parse(sql_match.to_s).map(&:last) |
|
|
|
sql_args.each_with_index do |value, index| |
|
|
|
sql_entry.gsub!("$#{index + 1}", colorize(value.inspect, BOLD) + sql_color_entry) |
|
|
|
sql_args.each_with_index do |val, index| |
|
|
|
sql_arg = val.inspect |
|
|
|
sql_arg = "'#{val.gsub("'", "''")}'" if val.is_a?(String) |
|
|
|
sql_entry.gsub!("$#{index + 1}", colorize(sql_arg, BOLD) + sql_color_entry) |
|
|
|
end |
|
|
|
log.message = [sql_type, sql_entry].join(CLEAR) |
|
|
|
end |
|
|
@ -178,7 +180,7 @@ class AnsiFormatter < SemanticLogger::Formatters::Color |
|
|
|
FAILOVER_WRAP |
|
|
|
end |
|
|
|
|
|
|
|
def unbold(text) = text.gsub!(BOLD, '') |
|
|
|
def unbold!(text) = text.gsub!(BOLD, '') |
|
|
|
|
|
|
|
def message |
|
|
|
colorize(log.message) if log.message |
|
|
|