Browse Source

memory as instance var

main
pvincent 5 months ago
parent
commit
8f76929e28
  1. 14
      lib/formatters/ansi_formatter.rb

14
lib/formatters/ansi_formatter.rb

@ -10,8 +10,6 @@ require 'json'
class AnsiFormatter < SemanticLogger::Formatters::Color class AnsiFormatter < SemanticLogger::Formatters::Color
include AnsiColors include AnsiColors
$memory = nil
CENTER_SIZE = 20 CENTER_SIZE = 20
FOREMAN_PREFIX_LENGTH = 18 FOREMAN_PREFIX_LENGTH = 18
FAILOVER_WRAP = 80 FAILOVER_WRAP = 80
@ -27,6 +25,8 @@ class AnsiFormatter < SemanticLogger::Formatters::Color
error: CLEAR + BG_RED + TEXT_WHITE, error: CLEAR + BG_RED + TEXT_WHITE,
fatal: CLEAR + BG_MAGENTA + BOLD + TEXT_WHITE fatal: CLEAR + BG_MAGENTA + BOLD + TEXT_WHITE
)) ))
@memory = nil
puts 'INITIALIZED2'
end end
def call(log, logger) def call(log, logger)
@ -53,17 +53,17 @@ class AnsiFormatter < SemanticLogger::Formatters::Color
if log.message.starts_with?('Started') if log.message.starts_with?('Started')
rails = '╓─╖' rails = '╓─╖'
before = 1 before = 1
if $memory
rails = "#{$memory}"
if @memory
rails = "#{@memory}"
before = 0 before = 0
end end
log.dimensions = AnsiDimensions.new(rails:, before:) log.dimensions = AnsiDimensions.new(rails:, before:)
$memory = nil
@memory = nil
elsif log.message.starts_with?('Completed 2') elsif log.message.starts_with?('Completed 2')
log.dimensions = AnsiDimensions.new(rails: TERMINUS_STRING, after: 1) log.dimensions = AnsiDimensions.new(rails: TERMINUS_STRING, after: 1)
elsif log.message.starts_with?('Completed 3') elsif log.message.starts_with?('Completed 3')
$memory = '║'
log.dimensions = AnsiDimensions.new(rails: "#{$memory}")
@memory = '║'
log.dimensions = AnsiDimensions.new(rails: "#{@memory}")
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')

Loading…
Cancel
Save