initialize fake logger

This commit is contained in:
coletdjnz 2024-06-03 11:38:06 +12:00
parent aef80ad64c
commit e1192b1bb3
No known key found for this signature in database
GPG Key ID: 91984263BB39894A
2 changed files with 4 additions and 4 deletions

View File

@ -23,7 +23,7 @@ class HandlerWrapper(handler):
RH_KEY = handler.RH_KEY RH_KEY = handler.RH_KEY
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(logger=FakeLogger, *args, **kwargs) super().__init__(logger=FakeLogger(), *args, **kwargs)
return HandlerWrapper return HandlerWrapper

View File

@ -232,14 +232,14 @@ def __init__(self, logger, *args, **kwargs):
def emit(self, record): def emit(self, record):
try: try:
msg = self.format(record) msg = self.format(record)
except Exception:
self.handleError(record)
else:
if record.levelno >= logging.ERROR: if record.levelno >= logging.ERROR:
self._logger.error(msg) self._logger.error(msg)
else: else:
self._logger.stdout(msg) self._logger.stdout(msg)
except Exception:
self.handleError(record)
@register_rh @register_rh
class RequestsRH(RequestHandler, InstanceStoreMixin): class RequestsRH(RequestHandler, InstanceStoreMixin):