discourse/config/initializers/100-quiet_logger.rb
Sam Saffron 30990006a9 DEV: enable frozen string literal on all files
This reduces chances of errors where consumers of strings mutate inputs
and reduces memory usage of the app.

Test suite passes now, but there may be some stuff left, so we will run
a few sites on a branch prior to merging
2019-05-13 09:31:32 +08:00

27 lines
626 B
Ruby

# frozen_string_literal: true
Rails.application.config.assets.configure do |env|
env.logger = Logger.new('/dev/null')
end
module DiscourseRackQuietAssetsLogger
def call(env)
override = false
if (env['PATH_INFO'].index("/assets/") == 0) ||
(env['PATH_INFO'].index("mini-profiler-resources") == 0)
if ::Logster::Logger === Rails.logger
override = true
Rails.logger.override_level = Logger::ERROR
end
end
super(env).tap do
if override
Rails.logger.override_level = nil
end
end
end
end
Rails::Rack::Logger.prepend DiscourseRackQuietAssetsLogger