Skip to content

Instantly share code, notes, and snippets.

@GitBubble
Last active July 11, 2018 13:40
Show Gist options
  • Save GitBubble/ab5fdf6573df1e5a89d3c3f73472317c to your computer and use it in GitHub Desktop.
Save GitBubble/ab5fdf6573df1e5a89d3c3f73472317c to your computer and use it in GitHub Desktop.
python
import logging

logging.basicConfig(level=logging.INFO,format='%(asctime)s - %(name)s- %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
print(__name__)
__main__
print logger
logger.info('this is log info')
2018-07-11 21:34:07,966 - __main__- INFO - this is log info
logger.warning('Warning exists')
2018-07-11 21:35:12,831 - __main__- WARNING - Warning exists
logger.warning('Warning exists')
2018-07-11 21:35:26,592 - __main__- WARNING - Warning exists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment