test : Add timestamp to logger when in debug mode

This commit is contained in:
wenzhouwww@live.cn 2022-07-10 16:24:18 +08:00
parent 08316af038
commit 28aebf77b7
1 changed files with 11 additions and 6 deletions

View File

@ -4,7 +4,8 @@ import logging
import os import os
import sys import sys
from typing import Optional from typing import Optional
import time , datetime
from datetime import datetime
import taos import taos
@ -67,19 +68,23 @@ class Logging:
@classmethod @classmethod
def info(cls, msg): def info(cls, msg):
cls.logger.info(msg) date = datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-1]
cls.logger.info("[time]: " + date +" [msg]: "+ msg)
@classmethod @classmethod
def debug(cls, msg): def debug(cls, msg):
cls.logger.debug(msg) date = datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-1]
cls.logger.debug("[time]: " + date +" [msg]: "+ msg)
@classmethod @classmethod
def warning(cls, msg): def warning(cls, msg):
cls.logger.warning(msg) date = datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-1]
cls.logger.warning("[time]: " + date +" [msg]: "+ msg)
@classmethod @classmethod
def error(cls, msg): def error(cls, msg):
cls.logger.error(msg) date = datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-1]
cls.logger.error("[time]: " + date +" [msg]: "+ msg)
class Status: class Status:
STATUS_EMPTY = 99 STATUS_EMPTY = 99