mirror of
https://github.com/borgbackup/borg.git
synced 2025-01-01 12:45:34 +00:00
borg.logger: use same method params as python logging
This commit is contained in:
parent
2787da205c
commit
ba2e8f2dec
1 changed files with 30 additions and 30 deletions
|
@ -266,43 +266,43 @@ def __logger(self):
|
||||||
def getChild(self, suffix):
|
def getChild(self, suffix):
|
||||||
return LazyLogger(self.__name + "." + suffix)
|
return LazyLogger(self.__name + "." + suffix)
|
||||||
|
|
||||||
def setLevel(self, *args, **kw):
|
def setLevel(self, level):
|
||||||
return self.__logger.setLevel(*args, **kw)
|
return self.__logger.setLevel(level)
|
||||||
|
|
||||||
def log(self, *args, **kw):
|
def log(self, level, msg, *args, **kwargs):
|
||||||
if "msgid" in kw:
|
if "msgid" in kwargs:
|
||||||
kw.setdefault("extra", {})["msgid"] = kw.pop("msgid")
|
kwargs.setdefault("extra", {})["msgid"] = kwargs.pop("msgid")
|
||||||
return self.__logger.log(*args, **kw)
|
return self.__logger.log(level, msg, *args, **kwargs)
|
||||||
|
|
||||||
def exception(self, *args, **kw):
|
def exception(self, msg, *args, exc_info=True, **kwargs):
|
||||||
if "msgid" in kw:
|
if "msgid" in kwargs:
|
||||||
kw.setdefault("extra", {})["msgid"] = kw.pop("msgid")
|
kwargs.setdefault("extra", {})["msgid"] = kwargs.pop("msgid")
|
||||||
return self.__logger.exception(*args, **kw)
|
return self.__logger.exception(msg, *args, exc_info=exc_info, **kwargs)
|
||||||
|
|
||||||
def debug(self, *args, **kw):
|
def debug(self, msg, *args, **kwargs):
|
||||||
if "msgid" in kw:
|
if "msgid" in kwargs:
|
||||||
kw.setdefault("extra", {})["msgid"] = kw.pop("msgid")
|
kwargs.setdefault("extra", {})["msgid"] = kwargs.pop("msgid")
|
||||||
return self.__logger.debug(*args, **kw)
|
return self.__logger.debug(msg, *args, **kwargs)
|
||||||
|
|
||||||
def info(self, *args, **kw):
|
def info(self, msg, *args, **kwargs):
|
||||||
if "msgid" in kw:
|
if "msgid" in kwargs:
|
||||||
kw.setdefault("extra", {})["msgid"] = kw.pop("msgid")
|
kwargs.setdefault("extra", {})["msgid"] = kwargs.pop("msgid")
|
||||||
return self.__logger.info(*args, **kw)
|
return self.__logger.info(msg, *args, **kwargs)
|
||||||
|
|
||||||
def warning(self, *args, **kw):
|
def warning(self, msg, *args, **kwargs):
|
||||||
if "msgid" in kw:
|
if "msgid" in kwargs:
|
||||||
kw.setdefault("extra", {})["msgid"] = kw.pop("msgid")
|
kwargs.setdefault("extra", {})["msgid"] = kwargs.pop("msgid")
|
||||||
return self.__logger.warning(*args, **kw)
|
return self.__logger.warning(msg, *args, **kwargs)
|
||||||
|
|
||||||
def error(self, *args, **kw):
|
def error(self, msg, *args, **kwargs):
|
||||||
if "msgid" in kw:
|
if "msgid" in kwargs:
|
||||||
kw.setdefault("extra", {})["msgid"] = kw.pop("msgid")
|
kwargs.setdefault("extra", {})["msgid"] = kwargs.pop("msgid")
|
||||||
return self.__logger.error(*args, **kw)
|
return self.__logger.error(msg, *args, **kwargs)
|
||||||
|
|
||||||
def critical(self, *args, **kw):
|
def critical(self, msg, *args, **kwargs):
|
||||||
if "msgid" in kw:
|
if "msgid" in kwargs:
|
||||||
kw.setdefault("extra", {})["msgid"] = kw.pop("msgid")
|
kwargs.setdefault("extra", {})["msgid"] = kwargs.pop("msgid")
|
||||||
return self.__logger.critical(*args, **kw)
|
return self.__logger.critical(msg, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def create_logger(name: str = None) -> LazyLogger:
|
def create_logger(name: str = None) -> LazyLogger:
|
||||||
|
|
Loading…
Reference in a new issue