From e07553c3627b80f20cdc81a35030bf0540924db8 Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 30 Oct 2018 14:58:48 +0000 Subject: Add type/return hints throughout src/ and, in doing so, fix some cyclical references. --- src/Logging.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/Logging.py') diff --git a/src/Logging.py b/src/Logging.py index 6ea6efe8..d5c42e56 100644 --- a/src/Logging.py +++ b/src/Logging.py @@ -1,4 +1,4 @@ -import logging, logging.handlers, os, sys, time +import logging, logging.handlers, os, sys, time, typing LEVELS = { "trace": logging.DEBUG-1, @@ -23,7 +23,7 @@ class BitBotFormatter(logging.Formatter): return s class Log(object): - def __init__(self, level, location): + def __init__(self, level: str, location: str): logging.addLevelName(LEVELS["trace"], "TRACE") self.logger = logging.getLogger(__name__) @@ -49,17 +49,17 @@ class Log(object): file_handler.setFormatter(formatter) self.logger.addHandler(file_handler) - def trace(self, message, params, **kwargs): + def trace(self, message: str, params: typing.List, **kwargs): self._log(message, params, LEVELS["trace"], kwargs) - def debug(self, message, params, **kwargs): + def debug(self, message: str, params: typing.List, **kwargs): self._log(message, params, logging.DEBUG, kwargs) - def info(self, message, params, **kwargs): + def info(self, message: str, params: typing.List, **kwargs): self._log(message, params, logging.INFO, kwargs) - def warn(self, message, params, **kwargs): + def warn(self, message: str, params: typing.List, **kwargs): self._log(message, params, logging.WARN, kwargs) - def error(self, message, params, **kwargs): + def error(self, message: str, params: typing.List, **kwargs): self._log(message, params, logging.ERROR, kwargs) - def critical(self, message, params, **kwargs): + def critical(self, message: str, params: typing.List, **kwargs): self._log(message, params, logging.CRITICAL, kwargs) - def _log(self, message, params, level, kwargs): + def _log(self, message: str, params: typing.List, level: int, kwargs: dict): self.logger.log(level, message, *params, **kwargs) -- cgit v1.3.1-10-gc9f91