There are five kinds of log levels:
DEBUG Level 1.static:
DEBUG Level pointed out that fine-grained information events for debugging applications are very helpful.
Level INFO 2.static
INFO Level show messages on the coarse-grained level to highlight the process of running the application.
Level WARN 3.static
WARN Level indicates that there will be a potential error situation.
ERROR Level 4.static
ERROR Level pointed out that although the error event, but still does not affect the continued operation of the system.
Level FATAL 5.static
FATAL Level pointed out that every serious error occurs if exiting the application.
To print out the log normal, you need to specify the log level to be printed in the header
import logging
logging.basicConfig(level=logging.INFO)
logging.error('error') # 显示
logging.warning('warning') # 显示
logging.debug('debug') # 不显示
logging.info('info') # 显示
Int value of each of the one level corresponds to the log, the log if the level is less than the set value: logging.INFO, will not be printed
CRITICAL = 50
FATAL = CRITICAL
ERROR = 40
WARNING = 30
WARN = WARNING
INFO = 20
DEBUG = 10
NOTSET = 0