|
@ -2,7 +2,10 @@ module Semantic |
|
|
# use the Zeitwerk autoloader to reattach_appender for development autoreloading feature |
|
|
# use the Zeitwerk autoloader to reattach_appender for development autoreloading feature |
|
|
class DevLoader |
|
|
class DevLoader |
|
|
def initialize |
|
|
def initialize |
|
|
Rails.autoloaders.main.on_load('ApplicationController') { append_ansi_formatter } |
|
|
|
|
|
|
|
|
Rails.autoloaders.main.on_load('ApplicationController') do |
|
|
|
|
|
append_ansi_formatter |
|
|
|
|
|
append_subscriber_once |
|
|
|
|
|
end |
|
|
append_ansi_formatter |
|
|
append_ansi_formatter |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
@ -15,5 +18,13 @@ module Semantic |
|
|
formatter:, |
|
|
formatter:, |
|
|
filter: ->(log) { !formatter.reject(log) }) |
|
|
filter: ->(log) { !formatter.reject(log) }) |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def append_subscriber_once |
|
|
|
|
|
return unless @previous_subscribe.nil? |
|
|
|
|
|
|
|
|
|
|
|
@previous_subscribe = ActiveSupport::Notifications.subscribe 'start_processing.action_controller' do |event| |
|
|
|
|
|
Semantic::LogSubscriber.new.start_processing(event) |
|
|
|
|
|
end |
|
|
|
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
end |