Created
May 13, 2021 03:48
-
-
Save Abhayparashar31/85a31fbcfa877fef6bac559e40d003b8 to your computer and use it in GitHub Desktop.
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 logging | |
| import logging.config | |
| ## Loads The Config File | |
| logging.config.fileConfig('logging.conf') | |
| # create a logger with the name from the config file. | |
| # This logger now has StreamHandler with DEBUG Level and the specified format in the logging.conf file | |
| logger = logging.getLogger('simpleExample') | |
| ## Log Messages | |
| logger.debug('debug message') | |
| logger.info('info message') | |
| ---------------------------CONSOLE OUTPUT---------------------------- | |
| 2021-05-13 09:16:23,263 - simpleExample - DEBUG - debug message | |
| 2021-05-13 09:16:23,263 - simpleExample - INFO - info message |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment