Skip to content

Instantly share code, notes, and snippets.

@sengstacken
Created December 21, 2020 18:37
Show Gist options
  • Save sengstacken/9dbecc9c9b1aee4461015d4be758e5e9 to your computer and use it in GitHub Desktop.
Save sengstacken/9dbecc9c9b1aee4461015d4be758e5e9 to your computer and use it in GitHub Desktop.
Example of how to use the logging function within python
import logging
import sys, os
logging.basicConfig(level="INFO", handlers=[logging.StreamHandler(sys.stdout)], format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
# logging.basicConfig(filename='example.log', encoding='utf-8', level=logging.DEBUG)
logging.debug('This message should appear on the console')
logging.info('So should this')
logging.warning('And this, too')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment