mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 01:24:03 +08:00
c9964b95ce
This reduces the amount of noise in our logs.
28 lines
681 B
Ruby
28 lines
681 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) ||
|
|
(env['PATH_INFO'].index("/srv/status") == 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
|