|
@ -2,6 +2,7 @@ require_relative 'ansi_dimensions' |
|
|
|
|
|
|
|
|
# filter log message |
|
|
# filter log message |
|
|
module AnsiFilter |
|
|
module AnsiFilter |
|
|
|
|
|
$memory = nil |
|
|
def self.reject(log) |
|
|
def self.reject(log) |
|
|
# log.name == 'ScoresController' || false |
|
|
# log.name == 'ScoresController' || false |
|
|
false |
|
|
false |
|
@ -9,11 +10,21 @@ module AnsiFilter |
|
|
|
|
|
|
|
|
def self.alter(log) |
|
|
def self.alter(log) |
|
|
if log.name == 'Rails' && log.message |
|
|
if log.name == 'Rails' && log.message |
|
|
log.dimensions = AnsiDimensions.new(rails: '╓─╖', before: 1) if log.message.starts_with?('Started') |
|
|
|
|
|
|
|
|
|
|
|
if log.message.starts_with?('Completed 200 OK') |
|
|
|
|
|
log.dimensions = AnsiDimensions.new(rails: '╙─╜', after: 1) |
|
|
|
|
|
log.message.chomp!('') |
|
|
log.message.chomp!('') |
|
|
|
|
|
if log.message.starts_with?('Started') |
|
|
|
|
|
rails = '╓─╖' |
|
|
|
|
|
rails = "╓#{$memory}╖" if $memory |
|
|
|
|
|
log.dimensions = AnsiDimensions.new(rails:) |
|
|
|
|
|
$memory = nil |
|
|
|
|
|
elsif log.message.starts_with?('Completed 2') |
|
|
|
|
|
log.dimensions = AnsiDimensions.new(rails: '╙─╜', after: 2) |
|
|
|
|
|
elsif log.message.starts_with?('Completed 3') |
|
|
|
|
|
$memory = '║' |
|
|
|
|
|
log.dimensions = AnsiDimensions.new(rails: "╙#{$memory}╜") |
|
|
|
|
|
elsif log.message.starts_with?('Completed 4') |
|
|
|
|
|
log.dimensions = AnsiDimensions.new(rails: '╙╨╜') |
|
|
|
|
|
elsif log.message.starts_with?('Completed 5') |
|
|
|
|
|
log.dimensions = AnsiDimensions.new(rails: '╙⯶╜') |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
log |
|
|
log |
|
|