Created
February 22, 2019 09:47
-
-
Save dryrain39/db3d698fa6d2c3a174a839d55d79a822 to your computer and use it in GitHub Desktop.
파이썬 로깅 세팅
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import datetime | |
date_string = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') | |
logging.basicConfig( | |
level=logging.INFO, | |
format='%(asctime)s [%(levelname)s] %(message)s', | |
handlers=[ | |
logging.FileHandler("./{0}/{1}.log".format('log', 'projectname_' + date_string)), | |
logging.StreamHandler() | |
]) | |
logging.info('yeah!') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment