update get_datetime method
This commit is contained in:
parent
d27b42d26f
commit
58999777aa
|
@ -44,6 +44,10 @@ class MyLoggingAdapter(logging.LoggerAdapter):
|
||||||
class Logging:
|
class Logging:
|
||||||
logger = None # type: Optional[MyLoggingAdapter]
|
logger = None # type: Optional[MyLoggingAdapter]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _get_datetime(cls):
|
||||||
|
return datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-1]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getLogger(cls):
|
def getLogger(cls):
|
||||||
return cls.logger
|
return cls.logger
|
||||||
|
@ -68,23 +72,19 @@ class Logging:
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def info(cls, msg):
|
def info(cls, msg):
|
||||||
date = datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-1]
|
cls.logger.info("[time]: " + cls._get_datetime() +" [msg]: "+ msg)
|
||||||
cls.logger.info("[time]: " + date +" [msg]: "+ msg)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def debug(cls, msg):
|
def debug(cls, msg):
|
||||||
date = datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-1]
|
cls.logger.debug("[time]: " + cls._get_datetime() +" [msg]: "+ msg)
|
||||||
cls.logger.debug("[time]: " + date +" [msg]: "+ msg)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def warning(cls, msg):
|
def warning(cls, msg):
|
||||||
date = datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-1]
|
cls.logger.warning("[time]: " + cls._get_datetime() +" [msg]: "+ msg)
|
||||||
cls.logger.warning("[time]: " + date +" [msg]: "+ msg)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def error(cls, msg):
|
def error(cls, msg):
|
||||||
date = datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-1]
|
cls.logger.error("[time]: " + cls._get_datetime() +" [msg]: "+ msg)
|
||||||
cls.logger.error("[time]: " + date +" [msg]: "+ msg)
|
|
||||||
|
|
||||||
class Status:
|
class Status:
|
||||||
STATUS_EMPTY = 99
|
STATUS_EMPTY = 99
|
||||||
|
|
Loading…
Reference in New Issue