From 36652fc5cdaeb83f54ff017de5906480a3e29d46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Mon, 15 Sep 2025 06:32:10 +0200 Subject: [PATCH] Add stubs to LazyLogger for code completion --- jellyfin_kodi/helper/lazylogger.py | 86 +++++++++++++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-) diff --git a/jellyfin_kodi/helper/lazylogger.py b/jellyfin_kodi/helper/lazylogger.py index bfd15f4b..fa4981a9 100644 --- a/jellyfin_kodi/helper/lazylogger.py +++ b/jellyfin_kodi/helper/lazylogger.py @@ -3,7 +3,8 @@ from __future__ import division, absolute_import, print_function, unicode_litera class LazyLogger(object): - """`helper.loghandler.getLogger()` is used everywhere. + """ + `helper.loghandler.getLogger()` is used everywhere. This class helps to avoid import errors. """ @@ -19,3 +20,86 @@ class LazyLogger(object): self.__logger = getLogger(self.__logger_name) return getattr(self.__logger, name) + + ##################################################################### + # Following are stubs of methods provided by `logging.Logger`. # + # Please ensure any actually functional code is above this comment. # + ##################################################################### + + def setLevel(self, level): + """ + Set the logging level of this logger. level must be an int or a str. + """ + ... + + def debug(self, msg, *args, **kwargs): + """ + Log 'msg % args' with severity 'DEBUG'. + + To pass exception information, use the keyword argument exc_info with + a true value, e.g. + + logger.debug("Houston, we have a %s", "thorny problem", exc_info=1) + """ + ... + + def info(self, msg, *args, **kwargs): + """ + Log 'msg % args' with severity 'INFO'. + + To pass exception information, use the keyword argument exc_info with + a true value, e.g. + + logger.info("Houston, we have a %s", "interesting problem", exc_info=1) + """ + ... + + def warning(self, msg, *args, **kwargs): + """ + Log 'msg % args' with severity 'WARNING'. + + To pass exception information, use the keyword argument exc_info with + a true value, e.g. + + logger.warning("Houston, we have a %s", "bit of a problem", exc_info=1) + """ + ... + + def error(self, msg, *args, **kwargs): + """ + Log 'msg % args' with severity 'ERROR'. + + To pass exception information, use the keyword argument exc_info with + a true value, e.g. + + logger.error("Houston, we have a %s", "major problem", exc_info=1) + """ + ... + + def exception(self, msg, *args, exc_info=True, **kwargs): + """ + Convenience method for logging an ERROR with exception information. + """ + ... + + def critical(self, msg, *args, **kwargs): + """ + Log 'msg % args' with severity 'CRITICAL'. + + To pass exception information, use the keyword argument exc_info with + a true value, e.g. + + logger.critical("Houston, we have a %s", "major disaster", exc_info=1) + """ + ... + + def log(self, level, msg, *args, **kwargs): + """ + Log 'msg % args' with the integer severity 'level'. + + To pass exception information, use the keyword argument exc_info with + a true value, e.g. + + logger.log(level, "We have a %s", "mysterious problem", exc_info=1) + """ + ...