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
19 lines
585 B
module Semantic
|
|
# use the Zeitwerk autoloader to reattach_appender for development autoreloading feature
|
|
class DevLoader
|
|
def initialize
|
|
Rails.autoloaders.main.on_load('ApplicationController') { append_ansi_formatter }
|
|
append_ansi_formatter
|
|
end
|
|
|
|
private
|
|
|
|
def append_ansi_formatter
|
|
SemanticLogger.clear_appenders!
|
|
formatter = Semantic::AnsiFormatter.new
|
|
SemanticLogger.add_appender(io: $stdout,
|
|
formatter:,
|
|
filter: ->(log) { !formatter.reject(log) })
|
|
end
|
|
end
|
|
end
|