2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-04-18 10:47:52 +08:00
|
|
|
Rails.application.config.assets.configure { |env| env.logger = Logger.new("/dev/null") }
|
|
|
|
|
2017-08-31 12:06:56 +08:00
|
|
|
module DiscourseRackQuietAssetsLogger
|
|
|
|
def call(env)
|
2017-02-01 04:44:46 +08:00
|
|
|
override = false
|
2020-09-01 09:52:04 +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) ||
|
2020-06-12 12:17:28 +08:00
|
|
|
(env["PATH_INFO"].index("mini-profiler-resources") == 0) ||
|
|
|
|
(env["PATH_INFO"].index("/srv/status") == 0)
|
2017-02-01 04:44:46 +08:00
|
|
|
if ::Logster::Logger === Rails.logger
|
|
|
|
override = true
|
|
|
|
Rails.logger.override_level = Logger::ERROR
|
|
|
|
end
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
|
|
|
|
2017-02-01 04:44:46 +08:00
|
|
|
super(env).tap { Rails.logger.override_level = nil if override }
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
2013-02-26 00:42:20 +08:00
|
|
|
end
|
2017-08-31 12:06:56 +08:00
|
|
|
|
|
|
|
Rails::Rack::Logger.prepend DiscourseRackQuietAssetsLogger
|