Skip to content

Instantly share code, notes, and snippets.

@dangsonbk
Created August 14, 2017 03:46
Show Gist options
  • Save dangsonbk/6e1949bf2f0df6557769a37c21d6bfa4 to your computer and use it in GitHub Desktop.
Save dangsonbk/6e1949bf2f0df6557769a37c21d6bfa4 to your computer and use it in GitHub Desktop.
Python logging basic config format
import logging
logging.basicConfig(level=logging.DEBUG, format=( '%(levelname)s:\t'
'%(filename)s:'
'%(funcName)s():'
'%(lineno)d\t'
'%(message)s'
)
)
# logging.basicConfig(filename='example.log',level=logging.DEBUG)
# logging.debug('Only use when debugging')
# logging.info('General information')
# logging.warning('General warning')
# logging.error("Input errors")
# logging.critical("Environment or script errors")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment