return if Rails.application.tailwind_watcher? RailsSemanticLogger::Rack::Logger.logger.level = :info # useful for remaining log like "[Rack::Log] Started..." SemanticLogger.clear_appenders! return unless Rails.application.server? def build_instrumentation_config { action_controller: true, action_view: Live::Constants::ACTION_VIEW # active_record: Live::Constants::ACTIVE_RECORD }.map do |key, value| key if value end.compact end Rails.configuration.after_initialize do Rails.logger.name = 'rails' ActiveSupport::Notifications.subscribe('rolling.live_constant') do |event| constants = event.payload[:changes].map { |change| change[:constant] } if constants.intersection(%w[ACTIVE_RECORD ACTION_VIEW]).any? Semantic::Instrumentalizer.activate(*build_instrumentation_config) end end end Rails.autoloaders.main.on_load('ApplicationController') do Rails.logger.debug 'Zeitwerk RELOAD!' Semantic::Instrumentalizer.activate(*build_instrumentation_config) end