Browse Source

memory as instance var

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

Loading…
Cancel
Save