Skip to content

Instantly share code, notes, and snippets.

@dryrain39
Created February 22, 2019 09:47
Show Gist options
  • Save dryrain39/db3d698fa6d2c3a174a839d55d79a822 to your computer and use it in GitHub Desktop.
Save dryrain39/db3d698fa6d2c3a174a839d55d79a822 to your computer and use it in GitHub Desktop.
파이썬 로깅 세팅
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