Skip to content

Commit

Permalink
lesson-3
Browse files Browse the repository at this point in the history
lesson-3
  • Loading branch information
Jack-Cherish authored May 5, 2020
1 parent 1e6c5d9 commit 23db136
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Pytorch-Seg/lesson-3/logger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import logging

def get_logger(LEVEL, log_file = None):
head = '[%(asctime)-15s] [%(levelname)s] %(message)s'
if LEVEL == 'info':
logging.basicConfig(level=logging.INFO, format=head)
elif LEVEL == 'debug':
logging.basicConfig(level=logging.DEBUG, format=head)
logger = logging.getLogger()
if log_file != None:
fh = logging.FileHandler(log_file)
logger.addHandler(fh)
return logger

logger = get_logger('info')

logger.info('Jack Cui')
logger.info('https://cuijiahua.com')
logger.info('https://mp.weixin.qq.com/s/OCWwRVDFNslIuKyiCVUoTA')

0 comments on commit 23db136

Please sign in to comment.