-
Notifications
You must be signed in to change notification settings - Fork 1
J. Enabling or Disabling Logger Level
Rayhan Ferdous edited this page Sep 19, 2017
·
1 revision
Logger levels have certain value.
- CRITICAL = 50
- ERROR = 40
- WARNING = 30
- INFO = 20
- DEBUG = 10
- NOTSET = 0
To use the feature of disabling/enabling you have to import logging
library and call the disable
function.
import logging
# to disable all logging
logging.disable(logging.CRITICAL)
# to re-enable all logging
logging.disable(logging.NOTSET)
If you disable any level with that command, that specific level as well as all levels below it will be disabled. That is why, if you disable CRITICAL, you will no longer see any log output in the file written. The same way, if you disable INFO, you will only see WARNING, ERROR and CRITICAL logs.
As you are using the logging library itself to disable/enable logging level, it will work through the entire experiment.