Browse Source

ANSI_CODE

pagy
pvincent 12 months ago
parent
commit
974e6fda83
  1. 21
      lib/formatters/basic_formatter.rb

21
lib/formatters/basic_formatter.rb

@ -3,19 +3,19 @@ class BasicFormatter < SemanticLogger::Formatters::Color
ANSI_REVERSED_WARNING = "\e[0;30;43m".freeze
ANSI_REVERSED_ERROR = "\e[1;30;41m".freeze
ANSI_REVERSED_FATAL = "\e[1;30;41m".freeze
ANSI_GRAY = "\e[90m".freeze
ANSI_GREEN = SemanticLogger::AnsiColors::GREEN
ANSI_YELLOW = SemanticLogger::AnsiColors::YELLOW
ANSI_RED = SemanticLogger::AnsiColors::RED
ANSI_MAGENTA = SemanticLogger::AnsiColors::MAGENTA
ANSI_DEBUG = "\e[90m".freeze
ANSI_INFO = SemanticLogger::AnsiColors::GREEN
ANSI_WARN = SemanticLogger::AnsiColors::YELLOW
ANSI_ERROR = SemanticLogger::AnsiColors::RED
ANSI_FATAL = SemanticLogger::AnsiColors::MAGENTA
def initialize
super(time_format: nil,
color_map: ColorMap.new(
debug: ANSI_GRAY,
info: ANSI_GREEN,
warn: ANSI_YELLOW,
fatal: ANSI_RED
debug: ANSI_DEBUG,
info: ANSI_INFO,
warn: ANSI_WARN,
fatal: ANSI_ERROR
))
end
@ -44,7 +44,8 @@ class BasicFormatter < SemanticLogger::Formatters::Color
end
def name
"#{color}#{log.name.ljust(20)}#{color_map.clear}"
# "#{color}#{log.name.ljust(20)}#{color_map.clear}"
"#{ANSI_DEBUG}#{log.name.rjust(20)}#{color_map.clear}"
end
def process_info

Loading…
Cancel
Save