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.

25 lines
923 B

  1. RailsSemanticLogger::Rack::Logger.logger.level = :info # useful for remaining log like "[Rack::Log] Started..."
  2. SemanticLogger.clear_appenders!
  3. im = nil
  4. # Zeitwerk reload message
  5. Rails.autoloaders.main.on_load('ApplicationController') do
  6. SemanticLogger[:zeitwerk].debug('reload!')
  7. im = Semantic::InstrumentationManager.new
  8. end
  9. Rails.configuration.after_initialize do
  10. Semantic::InstrumentationManager.clear
  11. bootstrap = [{ kind: :restored, constant: 'ACTION_VIEW', type: :boolean, old_value: false, new_value: true },
  12. { kind: :restored, constant: 'ACTION_CONTROLLER', type: :boolean, old_value: false, new_value: true }]
  13. im ||= Semantic::InstrumentationManager.new
  14. im.process(bootstrap)
  15. ActiveSupport::Notifications.subscribe('rolling.live_constant') do |event|
  16. puts event.payload[:changes].inspect
  17. im.process(event.payload[:changes])
  18. rescue StandardError => e
  19. puts e
  20. end
  21. end