|
|
@ -87,33 +87,8 @@ Rails.application.configure do # rubocop:disable Metrics/BlockLength |
|
|
|
# filter: ->(log) { !formatter.reject(log) }) |
|
|
|
end |
|
|
|
elsif Rails.application.server? |
|
|
|
|
|
|
|
config.after_initialize do |
|
|
|
source_location = Semantic::AnsiFormatter.instance_method(:initialize).source_location[0] |
|
|
|
previous_mtime = File.stat(source_location).mtime |
|
|
|
formatter = Semantic::AnsiFormatter.new |
|
|
|
# SemanticLogger.clear_appenders! |
|
|
|
SemanticLogger.add_appender(io: $stdout, |
|
|
|
formatter:, |
|
|
|
filter: ->(log) { !formatter.reject(log) }) |
|
|
|
|
|
|
|
[Semantic::AnsiFormatter, ApplicationController].each do |class_name| |
|
|
|
Rails.autoloaders.main.on_load(class_name.to_s) do |klass, abspath| |
|
|
|
if klass == Semantic::AnsiFormatter |
|
|
|
mtime = File.stat(source_location).mtime |
|
|
|
if previous_mtime != mtime |
|
|
|
previous_mtime = mtime |
|
|
|
SemanticLogger.clear_appenders! |
|
|
|
formatter = Semantic::AnsiFormatter.new |
|
|
|
SemanticLogger.add_appender(io: $stdout, |
|
|
|
formatter:, |
|
|
|
filter: lambda { |log| |
|
|
|
!formatter.reject(log) |
|
|
|
}) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
Semantic::DevLoader.new |
|
|
|
end |
|
|
|
end |
|
|
|
end |