Created
December 21, 2020 18:37
-
-
Save sengstacken/9dbecc9c9b1aee4461015d4be758e5e9 to your computer and use it in GitHub Desktop.
Example of how to use the logging function within python
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 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