Browse Source

autoreload formatter

main
pvincent 3 months ago
parent
commit
09fe8ad5bd
  1. 3
      config/initializers/instrumentalizing.rb
  2. 4
      lib/semantic/fancy_formatter.rb

3
config/initializers/instrumentalizing.rb

@ -27,6 +27,9 @@ Rails.configuration.after_initialize do
end
Rails.autoloaders.main.on_load('ApplicationController') do
SemanticLogger.clear_appenders!
SemanticLogger.add_appender(io: $stdout, formatter: Semantic::FancyFormatter.new)
Rails.logger.info ' ', dimensions: Semantic::FancyDimensions.new(rails: '╔═╗', before: 1)
Rails.logger.fatal 'Zeitwerk RELOAD!', dimensions: Semantic::FancyDimensions.new(rails: '╠█╣')
Rails.logger.info ' ', dimensions: Semantic::FancyDimensions.new(rails: '╚═╝')

4
lib/semantic/fancy_formatter.rb

@ -52,8 +52,8 @@ module Semantic
private
def tags
first_tag = log.tags.empty? ? TAG_NONE : log.tags.first
colorize(centerize(first_tag, 10), BG_GRAY + DARK_TEXT_YELLOW)
first_tag, taint = log.tags.empty? ? [TAG_NONE, CLEAR] : [log.tags.first, BG_GRAY + DARK_TEXT_YELLOW]
colorize(centerize(first_tag, 10), taint)
end
def named_tags

Loading…
Cancel
Save