From ba2e8f2decd643aa41693ccbdd0c27c3a631a4e8 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sat, 13 Jan 2024 23:56:43 +0100 Subject: [PATCH] borg.logger: use same method params as python logging --- src/borg/logger.py | 60 +++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/borg/logger.py b/src/borg/logger.py index 3dc76a290..471092921 100644 --- a/src/borg/logger.py +++ b/src/borg/logger.py @@ -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: