aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar jesopo2018-10-30 18:03:44 +0000
committerGravatar jesopo2018-10-30 18:03:44 +0000
commit7d54bd6ad06b39fe716392ebda69f9a087104d1d (patch)
tree2e8e3a3fc37cd3817d97849acf5dd74cf4c296d7
parentUpdate modules/line_handler.py to now not pass a `server` param to (diff)
signature
Move setting BitBotFormatter's converter (to time.gmtime) to class definition as
it's not technically correct to overwrite a funcion on an existing object
-rw-r--r--src/Logging.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Logging.py b/src/Logging.py
index d5c42e56..a4af69f7 100644
--- a/src/Logging.py
+++ b/src/Logging.py
@@ -10,6 +10,7 @@ LEVELS = {
}
class BitBotFormatter(logging.Formatter):
+ converter = time.gmtime
def formatTime(self, record, datefmt=None):
ct = self.converter(record.created)
if datefmt:
@@ -36,7 +37,6 @@ class Log(object):
formatter = BitBotFormatter(
"%(asctime)s [%(levelname)s] %(message)s",
"%Y-%m-%dT%H:%M:%S.%fZ")
- formatter.converter = time.gmtime
stdout_handler = logging.StreamHandler(sys.stdout)
stdout_handler.setLevel(stdout_level)