mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 06:53:44 +08:00
2301dddcff
* 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>
68 lines
1.0 KiB
Ruby
68 lines
1.0 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
class FakeLogger
|
|
attr_reader :debugs, :infos, :warnings, :errors, :fatals, :severities
|
|
attr_accessor :level
|
|
|
|
def initialize
|
|
@debugs = []
|
|
@infos = []
|
|
@warnings = []
|
|
@errors = []
|
|
@fatals = []
|
|
@level = Logger::DEBUG
|
|
@severities = { 0 => :debugs, 1 => :infos, 2 => :warnings, 3 => :errors, 4 => :fatals }
|
|
end
|
|
|
|
def debug(message = nil)
|
|
@debugs << message
|
|
end
|
|
|
|
def debug?
|
|
@level <= Logger::DEBUG
|
|
end
|
|
|
|
def info(message = nil)
|
|
@infos << message
|
|
end
|
|
|
|
def info?
|
|
@level <= Logger::INFO
|
|
end
|
|
|
|
def warn(message = nil)
|
|
@warnings << message
|
|
end
|
|
|
|
def warn?
|
|
@level <= Logger::WARN
|
|
end
|
|
|
|
def error(message = nil)
|
|
@errors << message
|
|
end
|
|
|
|
def error?
|
|
@level <= Logger::ERROR
|
|
end
|
|
|
|
def fatal(message = nil)
|
|
@fatals << message
|
|
end
|
|
|
|
def fatal?
|
|
@level <= Logger::FATAL
|
|
end
|
|
|
|
def formatter
|
|
end
|
|
|
|
def add(severity, message = nil, progname = nil)
|
|
public_send(severities[severity]) << message
|
|
end
|
|
|
|
def broadcasts
|
|
[self]
|
|
end
|
|
end
|