From 57b40f3b13b93ce3947c4f2a1ece0eb2533653ed Mon Sep 17 00:00:00 2001 From: pvincent Date: Mon, 9 Sep 2024 02:04:31 +0400 Subject: [PATCH] TAG_NONE --- lib/semantic/ansi_formatter.rb | 3 ++- lib/semantic/log_subscriber.rb | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/semantic/ansi_formatter.rb b/lib/semantic/ansi_formatter.rb index e1d41eb..eb21a4d 100644 --- a/lib/semantic/ansi_formatter.rb +++ b/lib/semantic/ansi_formatter.rb @@ -7,6 +7,7 @@ module Semantic class AnsiFormatter < SemanticLogger::Formatters::Color include AnsiColors + TAG_NONE = ''.freeze CENTER_SIZE = 20 FOREMAN_PREFIX_LENGTH = 18 FAILOVER_WRAP = 80 @@ -47,7 +48,7 @@ module Semantic private def tags - first_tag = log.tags.empty? ? 'none' : log.tags.first + first_tag = log.tags.empty? ? TAG_NONE : log.tags.first colorize(centerize(first_tag, 10), BG_GRAY + DARK_TEXT_YELLOW) end diff --git a/lib/semantic/log_subscriber.rb b/lib/semantic/log_subscriber.rb index 93e695d..cf3b3c4 100644 --- a/lib/semantic/log_subscriber.rb +++ b/lib/semantic/log_subscriber.rb @@ -4,7 +4,6 @@ module Semantic include AnsiColors # def logger = SemanticLogger['Rails'] - EMPTY = 'none'.freeze INTERNAL_PARAMS = %i[controller action format _method only_path].freeze def initialize(session_key) @@ -66,7 +65,7 @@ module Semantic private - def session_value(event) = event.payload[:headers]['rack.session'].fetch(@session_key, EMPTY) + def session_value(event) = event.payload[:headers]['rack.session'].fetch(@session_key, nil) def process_duration(event, additions) = "Processed in #{event.duration.round}ms (#{additions.join(' | ')})" end end