1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-29 11:16:43 +00:00

borg.logger: use same method params as python logging

This commit is contained in:
Thomas Waldmann 2024-01-13 23:56:43 +01:00
parent 2787da205c
commit ba2e8f2dec
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01

View file

@ -266,43 +266,43 @@ def __logger(self):
def getChild(self, suffix):
return LazyLogger(self.__name + "." + suffix)
def setLevel(self, *args, **kw):
return self.__logger.setLevel(*args, **kw)
def setLevel(self, level):
return self.__logger.setLevel(level)
def log(self, *args, **kw):
if "msgid" in kw:
kw.setdefault("extra", {})["msgid"] = kw.pop("msgid")
return self.__logger.log(*args, **kw)
def log(self, level, msg, *args, **kwargs):
if "msgid" in kwargs:
kwargs.setdefault("extra", {})["msgid"] = kwargs.pop("msgid")
return self.__logger.log(level, msg, *args, **kwargs)
def exception(self, *args, **kw):
if "msgid" in kw:
kw.setdefault("extra", {})["msgid"] = kw.pop("msgid")
return self.__logger.exception(*args, **kw)
def exception(self, msg, *args, exc_info=True, **kwargs):
if "msgid" in kwargs:
kwargs.setdefault("extra", {})["msgid"] = kwargs.pop("msgid")
return self.__logger.exception(msg, *args, exc_info=exc_info, **kwargs)
def debug(self, *args, **kw):
if "msgid" in kw:
kw.setdefault("extra", {})["msgid"] = kw.pop("msgid")
return self.__logger.debug(*args, **kw)
def debug(self, msg, *args, **kwargs):
if "msgid" in kwargs:
kwargs.setdefault("extra", {})["msgid"] = kwargs.pop("msgid")
return self.__logger.debug(msg, *args, **kwargs)
def info(self, *args, **kw):
if "msgid" in kw:
kw.setdefault("extra", {})["msgid"] = kw.pop("msgid")
return self.__logger.info(*args, **kw)
def info(self, msg, *args, **kwargs):
if "msgid" in kwargs:
kwargs.setdefault("extra", {})["msgid"] = kwargs.pop("msgid")
return self.__logger.info(msg, *args, **kwargs)
def warning(self, *args, **kw):
if "msgid" in kw:
kw.setdefault("extra", {})["msgid"] = kw.pop("msgid")
return self.__logger.warning(*args, **kw)
def warning(self, msg, *args, **kwargs):
if "msgid" in kwargs:
kwargs.setdefault("extra", {})["msgid"] = kwargs.pop("msgid")
return self.__logger.warning(msg, *args, **kwargs)
def error(self, *args, **kw):
if "msgid" in kw:
kw.setdefault("extra", {})["msgid"] = kw.pop("msgid")
return self.__logger.error(*args, **kw)
def error(self, msg, *args, **kwargs):
if "msgid" in kwargs:
kwargs.setdefault("extra", {})["msgid"] = kwargs.pop("msgid")
return self.__logger.error(msg, *args, **kwargs)
def critical(self, *args, **kw):
if "msgid" in kw:
kw.setdefault("extra", {})["msgid"] = kw.pop("msgid")
return self.__logger.critical(*args, **kw)
def critical(self, msg, *args, **kwargs):
if "msgid" in kwargs:
kwargs.setdefault("extra", {})["msgid"] = kwargs.pop("msgid")
return self.__logger.critical(msg, *args, **kwargs)
def create_logger(name: str = None) -> LazyLogger: