Created
October 16, 2017 14:03
-
-
Save tadone/cadb27a93602d97959cefc7d62739055 to your computer and use it in GitHub Desktop.
[Logging] Basic logging
This file contains hidden or 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 module | |
import logging | |
# Logging to console | |
logging.warning('Watch out!') # will print a message to the console | |
logging.info('I told you so') # will not print anything | |
>>>WARNING:root:Watch out! | |
# Logging to a file | |
logging.basicConfig(filename='example.log',level=logging.DEBUG) | |
logging.debug('This message should go to the log file') | |
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