import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
print(logger.level) # 10
print(logging.getLevelName(logger.level)) # DEBUG
# Note: Only levels on or above the current chosen level are outputted
Logging Levels -> Numeric Value
CRITICAL -> 50
ERROR -> 40
WARNING -> 30
INFO -> 20
DEBUG -> 10
NOTSET -> 0
# python logging level
Level: NOTSET > DEBUG > INFO > WARNING > ERROR > CRITICAL
Value: 0 > 10 > 20 > 30 > 40 > 50
Logger.setLevel() specifies the lowest-severity log message a logger will
handle, where debug is the lowest built-in severity level and critical is
the highest built-in severity.
For example, if the severity level is INFO, the logger will handle only INFO,
WARNING, ERROR, and CRITICAL messages and will ignore DEBUG messages.
Logging Levels
CRITICAL
ERROR
WARNING
INFO
DEBUG
NOTSET