Class: Browserlog::LogColorize

Inherits:
Object
  • Object
show all
Defined in:
lib/browserlog/log_colorize.rb

Constant Summary collapse

REXP_REQUEST =
/^Started (?<method>\w+) "(?<path>[\w\/\?\&\=\.]+)" for (?<ip>[\d\.]+) at (?<date>[\w:\-\s]+)$/
REXP_CONTROLLER =
/^Processing by (?<controller>[\w\:]+)#(?<action>\w+) as (?<format>\w+)$/
REXP_RENDER =
/^\s*Rendered (?<path>.*\/)(?<template_name>\w+\.html\.\w+) \((?<rendering_time>[\d+\.]+ms)\)$/
REXP_RENDER_WITHIN =
/^\s*Rendered (?<path>.*\/)(?<template_name>\w+\.html\.\w+) within (?<layout_name>[\w\d\/]+) ?\((?<rendering_time>[\d+\.]+ms)\)$/
REXP_COMPLETE =
/^Completed (?<status>\d+\s\w+) in (?<total_time>[\d+\.]+ms) (?<last_bit>.*)$/
REXP_SQL_QUERY =
/^\s*(?<model_load>[\w:]+ Load) \((?<rendering_time>[\d+\.]+ms)\) \s*(?<sql_query>.*)$/

Instance Method Summary collapse

Instance Method Details

#colorize_line(line) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/browserlog/log_colorize.rb', line 10

def colorize_line(line)
  line = strip_ansi_colors(line)
  line = colorize(line)
rescue => e
  puts "Could not colorize: #{e.message}"
  line
end