From 8b4824b21c4475f9a7111cee7bc0195463a9ab79 Mon Sep 17 00:00:00 2001 From: pvincent Date: Mon, 15 Jan 2024 17:21:58 +0400 Subject: [PATCH] debug downcase --- app/controllers/scores_controller.rb | 6 +++--- lib/formatters/basic_formatter.rb | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/controllers/scores_controller.rb b/app/controllers/scores_controller.rb index 4516eb0..25b1a79 100644 --- a/app/controllers/scores_controller.rb +++ b/app/controllers/scores_controller.rb @@ -7,10 +7,10 @@ class ScoresController < ApplicationController @scores = Score.all logger.info 'this is an information', { 'one': 1, 'two': 2 } logger.info 'this is an object', BigDecimal('0.0001') - # logger.warn 'this is a warning' - # logger.error 'this is an error' # logger.debug 'this is a debug message' - # logger.fatal 'FATAL' + logger.warn 'this is a warning' + logger.error 'this is an error', BigDecimal('0.0002') + logger.fatal 'FATAL' logger.debug 'score are', @scores end diff --git a/lib/formatters/basic_formatter.rb b/lib/formatters/basic_formatter.rb index b1c3c51..75f461e 100644 --- a/lib/formatters/basic_formatter.rb +++ b/lib/formatters/basic_formatter.rb @@ -8,7 +8,7 @@ class BasicFormatter < SemanticLogger::Formatters::Color NAME_MAX_SIZE = 25 TERMINAL_PREFIX = ENV['TERMINAL_PREFIX'].to_i || 0 CONTENT_PREFIX = ' '.freeze - WRAP_PREFIX = ' > '.freeze + WRAP_PREFIX = ' … '.freeze ANSI_DEBUG = "\e[90m".freeze ANSI_INFO = SemanticLogger::AnsiColors::GREEN @@ -77,7 +77,11 @@ class BasicFormatter < SemanticLogger::Formatters::Color end def level - level = log.level == :info ? ' ' : log.level.to_s.chr.upcase + level = case log.level + when :info then ' ' + when :debug then 'd' + else log.level.to_s.chr.upcase + end "#{color}╣#{level}╠#{color_map.clear}" end