mirror of
https://github.com/PaddlePaddle/PaddleClas.git
synced 2025-06-03 21:55:06 +08:00
fix wrong log time and format
This commit is contained in:
parent
d5f0a14126
commit
15767e0f45
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user