Browse Source

paramaters

main
pvincent 5 months ago
parent
commit
a4c1f22411
  1. 10
      lib/formatters/ansi_formatter.rb

10
lib/formatters/ansi_formatter.rb

@ -72,6 +72,16 @@ class AnsiFormatter < SemanticLogger::Formatters::Color
log.dimensions = AnsiDimensions.new(rails:, before:) log.dimensions = AnsiDimensions.new(rails:, before:)
@memory = nil @memory = nil
log.message = two_captures_last_as_bold(log.message, /(^Started \w* )"(.*?)"/) log.message = two_captures_last_as_bold(log.message, /(^Started \w* )"(.*?)"/)
elsif log.message.starts_with?('Parameters')
parameters = log.message.match(/Parameters: ({.*}$)/).match(1)
parameters = JSON.parse(parameters.gsub('=>', ':'), symbolize_names: true)
parameters = parameters.ai(ruby19_syntax: true, plain: true, multiline: false)
parameters = parameters.gsub(/\w*:/) { |key| "#{TEXT_GRAY_200}#{key.chop}#{color_map[:debug]}:" }
parameters = parameters.gsub(/: ".*?"/) do |value|
": \"#{TEXT_YELLOW}#{value[3..-2]}#{color_map[:debug]}\""
end
log.message = "Parameters: #{parameters}"
log.level = :debug
elsif log.message.starts_with?('Completed') elsif log.message.starts_with?('Completed')
m1, m2, m3, m4 = log.message.match(/^Completed (\d+) (.*) in (\d+\.?\d*)ms (.*)$/).captures m1, m2, m3, m4 = log.message.match(/^Completed (\d+) (.*) in (\d+\.?\d*)ms (.*)$/).captures
http_code = m1.to_i http_code = m1.to_i

Loading…
Cancel
Save