fix wrong log time and format

This commit is contained in:
shippingwang 2020-05-06 09:11:40 +00:00
parent d5f0a14126
commit 15767e0f45

View File

@ -14,10 +14,25 @@
import logging
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__)
Color= {
'RED' : '\033[31m' ,
'HEADER' : '\033[35m' , # deep purple
@ -28,6 +43,7 @@ Color= {
'FAIL' : '\033[91m' ,
'ENDC' : '\033[0m' }
def coloring(message, color="OKGREEN"):
assert color in Color.keys()
if os.environ.get('PADDLECLAS_COLORING', False):
@ -35,6 +51,7 @@ def coloring(message, color="OKGREEN"):
else:
return message
def anti_fleet(log):
"""
logs will print multi-times when calling Fleet API.