Browse Source

$memory

main
pvincent 6 months ago
parent
commit
49783048c7
  1. 19
      lib/formatters/ansi_filter.rb
  2. 26
      lib/formatters/symbols.txt

19
lib/formatters/ansi_filter.rb

@ -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

26
lib/formatters/symbols.txt

@ -48,13 +48,27 @@
╙ ╜ 300 redirect ╙ ╜ 300 redirect
╙⸾╜ 300 redirect ╙⸾╜ 300 redirect
╙ǁ╜
╙ ╜
╓ ╖
╣⸾╠
╙─╜
╙⍑╜ ╙⍑╜
╓─╖
╣⸾╠
╙─╜
╙─╜ ╙─╜
╓─╖ ╓─╖
╣⸾╠ ╣⸾╠
╙─╜ ╙─╜
╣─╠
╙┻╜
╓─╖
╙─╜
@ -65,6 +79,16 @@
╙⯶╜ 500 servererror ╙⯶╜ 500 servererror
╙ ╜ 500 servererror ╙ ╜ 500 servererror
00:20:45 web.1 | Rails ╣ ╠ Redirected to http://127.0.0.1:7500/scores/1
00:20:45 web.1 | Rails ╙║╜ Completed 303 See Other in 10ms (ActiveRecord: 0.7ms | Allocations: 2390)
00:20:45 web.1 | Rails ╓║╖ Started GET "/scores/1" for 127.0.0.1 at 2024-06-07 00:20:45 +0400
00:20:45 web.1 | Rails ╣ ╠ Processing by ScoresController#show as TURBO_STREAM
00:20:45 web.1 | Rails ╣ ╠ Parameters: {"id"=>"1"}
00:37:27 web.1 | Rails ╙║╜ Completed 303 See Other in 16ms (ActiveRecord: 0.8ms | Allocations: 2395)
00:37:27 web.1 | Rails ╓║╖ Started GET "/scores/1" for 127.0.0.1 at 2024-06-07 00:37:27 +0400
00:37:27 web.1 | Rails ╣ ╠ Processing by ScoresController#show as TURBO_STREAM
╣ ╠ ╣ ╠
╣⍑╠ ╣⍑╠
╣⍑╠ ╣⍑╠

Loading…
Cancel
Save