提交 15767e0f 编写于 作者: S shippingwang

fix wrong log time and format

上级 d5f0a141
...@@ -14,10 +14,25 @@ ...@@ -14,10 +14,25 @@
import logging import logging
import os import os
import datetime
logging.basicConfig(level=logging.INFO, format='%(message)s') from imp import reload
reload(logging)
logging.basicConfig(level=logging.INFO,
format="%(asctime)s %(levelname)s: %(message)s",
datefmt = "%Y-%m-%d %H:%M:%S")
def time_zone(sec, fmt):
real_time = datetime.datetime.now() + datetime.timedelta(hours=8)
return real_time.timetuple()
logging.Formatter.converter = time_zone
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
Color= { Color= {
'RED' : '\033[31m' , 'RED' : '\033[31m' ,
'HEADER' : '\033[35m' , # deep purple 'HEADER' : '\033[35m' , # deep purple
...@@ -28,6 +43,7 @@ Color= { ...@@ -28,6 +43,7 @@ Color= {
'FAIL' : '\033[91m' , 'FAIL' : '\033[91m' ,
'ENDC' : '\033[0m' } 'ENDC' : '\033[0m' }
def coloring(message, color="OKGREEN"): def coloring(message, color="OKGREEN"):
assert color in Color.keys() assert color in Color.keys()
if os.environ.get('PADDLECLAS_COLORING', False): if os.environ.get('PADDLECLAS_COLORING', False):
...@@ -35,6 +51,7 @@ def coloring(message, color="OKGREEN"): ...@@ -35,6 +51,7 @@ def coloring(message, color="OKGREEN"):
else: else:
return message return message
def anti_fleet(log): def anti_fleet(log):
""" """
logs will print multi-times when calling Fleet API. logs will print multi-times when calling Fleet API.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册