mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 09:53:32 +08:00
30990006a9
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
27 lines
626 B
Ruby
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
|