|
@ -1,15 +1,20 @@ |
|
|
require_relative 'ansi_dimensions' |
|
|
require_relative 'ansi_dimensions' |
|
|
|
|
|
require_relative 'ansi_colors' |
|
|
|
|
|
|
|
|
# filter log message |
|
|
# filter log message |
|
|
module AnsiFilter |
|
|
module AnsiFilter |
|
|
$memory = nil |
|
|
$memory = nil |
|
|
|
|
|
|
|
|
|
|
|
CHAR_FATAL = '⯶'.freeze |
|
|
|
|
|
|
|
|
def self.reject(log) |
|
|
def self.reject(log) |
|
|
# log.name == 'ScoresController' || false |
|
|
# log.name == 'ScoresController' || false |
|
|
false |
|
|
false |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
def self.alter(log) |
|
|
def self.alter(log) |
|
|
if log.name == 'Rails' && log.message |
|
|
|
|
|
|
|
|
if log.name == 'Rails' |
|
|
|
|
|
if log.message |
|
|
log.message.chomp!('') |
|
|
log.message.chomp!('') |
|
|
if log.message.starts_with?('Started') |
|
|
if log.message.starts_with?('Started') |
|
|
rails = '╓─╖' |
|
|
rails = '╓─╖' |
|
@ -24,9 +29,16 @@ module AnsiFilter |
|
|
elsif log.message.starts_with?('Completed 4') |
|
|
elsif log.message.starts_with?('Completed 4') |
|
|
log.dimensions = AnsiDimensions.new(rails: '╙╨╜') |
|
|
log.dimensions = AnsiDimensions.new(rails: '╙╨╜') |
|
|
elsif log.message.starts_with?('Completed 5') |
|
|
elsif log.message.starts_with?('Completed 5') |
|
|
log.dimensions = AnsiDimensions.new(rails: '╙⯶╜') |
|
|
|
|
|
|
|
|
log.dimensions = AnsiDimensions.new(rails: "╙#{draw_fatal}╜") |
|
|
|
|
|
end |
|
|
|
|
|
elsif log.exception |
|
|
|
|
|
log.dimensions = AnsiDimensions.new(rails: "╓#{draw_fatal(log.level.to_s.chr.upcase)}╖", after: 2) |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
log |
|
|
log |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
private_class_method def self.draw_fatal(char = CHAR_FATAL) |
|
|
|
|
|
AnsiColors::BG_MAGENTA + AnsiColors::BOLD + AnsiColors::TEXT_WHITE + char + AnsiColors::CLEAR |
|
|
|
|
|
end |
|
|
end |
|
|
end |