2019-04-29 19:27:42 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-10-09 20:34:50 -05:00
|
|
|
class FakeLogger
|
2023-12-06 06:18:34 -06:00
|
|
|
attr_reader :debugs, :infos, :warnings, :errors, :fatals
|
2021-03-14 23:36:10 -05:00
|
|
|
attr_accessor :level
|
2018-10-09 20:34:50 -05:00
|
|
|
|
|
|
|
def initialize
|
2023-12-06 06:18:34 -06:00
|
|
|
@debugs = []
|
2018-10-22 12:22:23 -05:00
|
|
|
@infos = []
|
2022-05-04 20:50:43 -05:00
|
|
|
@warnings = []
|
|
|
|
@errors = []
|
2019-02-14 00:58:16 -06:00
|
|
|
@fatals = []
|
2022-10-12 13:25:49 -05:00
|
|
|
@level = Logger::DEBUG
|
2018-10-22 12:22:23 -05:00
|
|
|
end
|
|
|
|
|
2022-05-04 20:50:43 -05:00
|
|
|
def debug(message)
|
2023-12-06 06:18:34 -06:00
|
|
|
@debugs << message
|
2022-05-04 20:50:43 -05:00
|
|
|
end
|
|
|
|
|
2022-10-12 09:06:00 -05:00
|
|
|
def debug?
|
|
|
|
@level <= Logger::DEBUG
|
|
|
|
end
|
|
|
|
|
2018-10-22 12:22:23 -05:00
|
|
|
def info(message = nil)
|
|
|
|
@infos << message
|
2018-10-09 20:34:50 -05:00
|
|
|
end
|
|
|
|
|
2022-10-12 09:06:00 -05:00
|
|
|
def info?
|
|
|
|
@level <= Logger::INFO
|
|
|
|
end
|
|
|
|
|
2018-10-09 20:34:50 -05:00
|
|
|
def warn(message)
|
|
|
|
@warnings << message
|
|
|
|
end
|
|
|
|
|
2022-10-12 09:06:00 -05:00
|
|
|
def warn?
|
|
|
|
@level <= Logger::WARN
|
|
|
|
end
|
|
|
|
|
2018-10-09 20:34:50 -05:00
|
|
|
def error(message)
|
|
|
|
@errors << message
|
|
|
|
end
|
2019-02-14 00:58:16 -06:00
|
|
|
|
2022-10-12 09:06:00 -05:00
|
|
|
def error?
|
|
|
|
@level <= Logger::ERROR
|
|
|
|
end
|
|
|
|
|
2019-02-14 00:58:16 -06:00
|
|
|
def fatal(message)
|
|
|
|
@fatals << message
|
|
|
|
end
|
|
|
|
|
2022-10-12 09:06:00 -05:00
|
|
|
def fatal?
|
|
|
|
@level <= Logger::FATAL
|
|
|
|
end
|
|
|
|
|
2019-02-14 00:58:16 -06:00
|
|
|
def formatter
|
|
|
|
end
|
2018-10-09 20:34:50 -05:00
|
|
|
end
|