Created
June 4, 2020 17:54
-
-
Save ashishsinghucd/1eb7a404f47e5fc74567d51085faad6b to your computer and use it in GitHub Desktop.
How to use logging in python
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
logger = logging.getLogger(__name__) | |
handler = logging.StreamHandler() | |
logging_format = logging.Formatter('%(asctime)s %(name)s %(levelname)s - %(message)s') | |
handler.setFormatter(logging_format) | |
logger.setLevel(logging.DEBUG). # Do not use handler.setLevel(logging.DEBUG) | |
logger.addHandler(handler) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment