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.
39 lines
1.4 KiB
39 lines
1.4 KiB
return if Rails.application.tailwind_watcher?
|
|
|
|
return unless Rails.application.server?
|
|
|
|
if Rails.env.development?
|
|
RailsSemanticLogger::Rack::Logger.logger.level = :info # useful for remaining log like "[Rack::Log] Started..."
|
|
SemanticLogger.clear_appenders!
|
|
Rails.logger.name = 'rails'
|
|
end
|
|
|
|
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
|
|
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
|
|
SemanticLogger.clear_appenders!
|
|
SemanticLogger.add_appender(io: $stdout, formatter: Rails.application.config.x.semantic.formatter.constantize.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: '╚═╝')
|
|
|
|
Semantic::Instrumentalizer.activate(*build_instrumentation_config)
|
|
end
|