cartoonize / utils /logger.py
YANGYYYY's picture
Upload 8 files
922e494 verified
raw
history blame contribute delete
826 Bytes
import logging
def get_logger(path, *args, **kwargs):
# logger = logging.getLogger('train')
# logger.setLevel(logging.NOTSET)
# formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
# # add filehandler
# fh = logging.FileHandler(path)
# fh.setLevel(logging.NOTSET)
# fh.setFormatter(formatter)
# ch = logging.StreamHandler()
# ch.setLevel(logging.ERROR)
# logger.addHandler(fh)
# logger.addHandler(ch)
# return logger
logging.basicConfig(format = '%(asctime)s %(message)s',
datefmt = '%m/%d/%Y %I:%M:%S %p',
handlers=[
logging.FileHandler(path),
logging.StreamHandler()
],
level=logging.DEBUG)
return logging