mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 18:51:05 +08:00
ca4af53be8
* DEV: Upgrade Rails to 7.1
* FIX: Remove references to `Rails.logger.chained`
`Rails.logger.chained` was provided by Logster before Rails 7.1
introduced their broadcast logger. Now all the loggers are added to
`Rails.logger.broadcasts`.
Some code in our initializers was still using `chained` instead of
`broadcasts`.
* DEV: Make parameters optional to all FakeLogger methods
* FIX: Set `override_level` on Logster loggers (#27519)
A followup to f595d599dd
* FIX: Don’t duplicate Rack response
---------
Co-authored-by: Jarek Radosz <jradosz@gmail.com>
25 lines
886 B
Ruby
25 lines
886 B
Ruby
# frozen_string_literal: true
|
|
|
|
Rails.application.config.assets.configure { |env| env.logger = Logger.new("/dev/null") }
|
|
|
|
module DiscourseRackQuietAssetsLogger
|
|
def call(env)
|
|
override = false
|
|
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 defined?(::Logster::Logger) && Logster.logger
|
|
override = true
|
|
Logster.logger.override_level = Logger::ERROR
|
|
end
|
|
end
|
|
|
|
super(env).tap { Logster.logger.override_level = nil if override }
|
|
end
|
|
end
|
|
|
|
Rails::Rack::Logger.prepend DiscourseRackQuietAssetsLogger
|