aboutsummaryrefslogtreecommitdiff
path: root/src/Logging.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-10-30 14:58:48 +0000
committerGravatar jesopo2018-10-30 14:58:48 +0000
commite07553c3627b80f20cdc81a35030bf0540924db8 (patch)
tree0a81640b280e007cbe5d2cb956681068ab80c58e /src/Logging.py
parentDon't needlessly search a youtube URL before getting the information for it's (diff)
signature
Add type/return hints throughout src/ and, in doing so, fix some cyclical
references.
Diffstat (limited to 'src/Logging.py')
-rw-r--r--src/Logging.py18
1 files changed, 9 insertions, 9 deletions
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)