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.

21 lines
914 B

  1. RailsSemanticLogger::Rack::Logger.logger.level = :info # useful for remaining log like "[Rack::Log] Started..."
  2. SemanticLogger.clear_appenders!
  3. # Zeitwerk reload message
  4. Rails.autoloaders.main.on_load('ApplicationController') { SemanticLogger[:Zeitwerk].debug('reload!') }
  5. all_notifications = {
  6. action_controller: %i[start_processing process_action redirect_to],
  7. action_view: %i[render_partial render_template render_collection render_layout],
  8. active_record: %i[sql strict_loading instantiation start_transaction transaction]
  9. }
  10. Rails.configuration.after_initialize do
  11. all_notifications.each do |event_group, hooks|
  12. hooks.each { |hook| ActiveSupport::Notifications.unsubscribe("#{hook}.#{event_group}") }
  13. end
  14. ActiveSupport::Notifications.subscribe('rolling.live_constant') do |event|
  15. SemanticLogger[:live_notifications].warn('new event', event.payload) # FIXME: to be continued...
  16. end
  17. end