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.

26 lines
958 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. Rails.logger.name = 'error_trap'
  11. Semantic::InstrumentationManager.clear
  12. bootstrap = [{ kind: :restored, constant: 'ACTION_VIEW', type: :boolean, old_value: false, new_value: true },
  13. { kind: :restored, constant: 'ACTION_CONTROLLER', type: :boolean, old_value: false, new_value: true }]
  14. im ||= Semantic::InstrumentationManager.new
  15. im.process(bootstrap)
  16. ActiveSupport::Notifications.subscribe('rolling.live_constant') do |event|
  17. puts event.payload[:changes].inspect
  18. im.process(event.payload[:changes])
  19. rescue StandardError => e
  20. puts e
  21. end
  22. end