discourse/config/initializers/100-quiet_logger.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
904 B
Ruby
Raw Normal View History

# 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
2013-02-06 03:16:51 +08:00
if (env['PATH_INFO'].index("/assets/") == 0) ||
(env['PATH_INFO'].index("/stylesheets") == 0) ||
(env['PATH_INFO'].index("/svg-sprite") == 0) ||
(env['PATH_INFO'].index("/manifest") == 0) ||
(env['PATH_INFO'].index("/service-worker") == 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
2013-02-06 03:16:51 +08:00
end
super(env).tap do
if override
Rails.logger.override_level = nil
end
2013-02-06 03:16:51 +08:00
end
end
2013-02-26 00:42:20 +08:00
end
Rails::Rack::Logger.prepend DiscourseRackQuietAssetsLogger