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.

19 lines
585 B

3 months ago
  1. module Semantic
  2. # use the Zeitwerk autoloader to reattach_appender for development autoreloading feature
  3. class DevLoader
  4. def initialize
  5. Rails.autoloaders.main.on_load('ApplicationController') { append_ansi_formatter }
  6. append_ansi_formatter
  7. end
  8. private
  9. def append_ansi_formatter
  10. SemanticLogger.clear_appenders!
  11. formatter = Semantic::AnsiFormatter.new
  12. SemanticLogger.add_appender(io: $stdout,
  13. formatter:,
  14. filter: ->(log) { !formatter.reject(log) })
  15. end
  16. end
  17. end