Browse Source

TAG_NONE

main
pvincent 1 month ago
parent
commit
57b40f3b13
  1. 3
      lib/semantic/ansi_formatter.rb
  2. 3
      lib/semantic/log_subscriber.rb

3
lib/semantic/ansi_formatter.rb

@ -7,6 +7,7 @@ module Semantic
class AnsiFormatter < SemanticLogger::Formatters::Color class AnsiFormatter < SemanticLogger::Formatters::Color
include AnsiColors include AnsiColors
TAG_NONE = ''.freeze
CENTER_SIZE = 20 CENTER_SIZE = 20
FOREMAN_PREFIX_LENGTH = 18 FOREMAN_PREFIX_LENGTH = 18
FAILOVER_WRAP = 80 FAILOVER_WRAP = 80
@ -47,7 +48,7 @@ module Semantic
private private
def tags 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) colorize(centerize(first_tag, 10), BG_GRAY + DARK_TEXT_YELLOW)
end end

3
lib/semantic/log_subscriber.rb

@ -4,7 +4,6 @@ module Semantic
include AnsiColors include AnsiColors
# def logger = SemanticLogger['Rails'] # def logger = SemanticLogger['Rails']
EMPTY = 'none'.freeze
INTERNAL_PARAMS = %i[controller action format _method only_path].freeze INTERNAL_PARAMS = %i[controller action format _method only_path].freeze
def initialize(session_key) def initialize(session_key)
@ -66,7 +65,7 @@ module Semantic
private 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(' | ')})" def process_duration(event, additions) = "Processed in #{event.duration.round}ms (#{additions.join(' | ')})"
end end
end end
Loading…
Cancel
Save