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
This commit is contained in:
jesopo 2018-10-30 18:03:44 +00:00
parent b58a3f7329
commit 7d54bd6ad0

View file

@ -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)