You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

32 lines
1010 B

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