mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 01:33:45 +08:00
5cb84f8dcf
* Revert "FIX: Set `override_level` on Logster loggers (#27519)" This reverts commitc1b0488c54
. * Revert "DEV: Make parameters optional to all FakeLogger methods" This reverts commit3318dad7b4
. * Revert "FIX: Remove references to `Rails.logger.chained`" This reverts commitf595d599dd
. * Revert "DEV: Upgrade Rails to 7.1" This reverts commit081b00391e
.
59 lines
790 B
Ruby
59 lines
790 B
Ruby
# frozen_string_literal: true
|
|
|
|
class FakeLogger
|
|
attr_reader :debugs, :infos, :warnings, :errors, :fatals
|
|
attr_accessor :level
|
|
|
|
def initialize
|
|
@debugs = []
|
|
@infos = []
|
|
@warnings = []
|
|
@errors = []
|
|
@fatals = []
|
|
@level = Logger::DEBUG
|
|
end
|
|
|
|
def debug(message)
|
|
@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)
|
|
@warnings << message
|
|
end
|
|
|
|
def warn?
|
|
@level <= Logger::WARN
|
|
end
|
|
|
|
def error(message)
|
|
@errors << message
|
|
end
|
|
|
|
def error?
|
|
@level <= Logger::ERROR
|
|
end
|
|
|
|
def fatal(message)
|
|
@fatals << message
|
|
end
|
|
|
|
def fatal?
|
|
@level <= Logger::FATAL
|
|
end
|
|
|
|
def formatter
|
|
end
|
|
end
|