Issue 7199: Doc: Logging level order seems inconsistent (original) (raw)
LibRef 15.6, Logging module: <Assigned to Vinay because I understand you to be the current maintainer of logging. If wrong, please reassign.>
Intro start with "The default levels provided are DEBUG, INFO, WARNING, ERROR and CRITICAL." which seems like the proper ordering. Then
15.6.1.1. Simple examples "Another useful feature of the logging API is the ability to produce different messages at different log levels. This allows you to instrument your code with debug messages, for example, but turning the log level down so that those debug messages are not written for your production system. The default levels are CRITICAL, ERROR, WARNING, INFO, DEBUG and NOTSET.
The logger, handler, and log message call each specify a level. The log message is only emitted if the handler and logger are configured to emit messages of that level or lower. "
Ie, the order is reversed and the level specified is the highest level emitted, which struck me as backwards, versus
15.6.1.2. Loggers "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. "
so that it emits the that level or higher. (although notset is the actual lowest built-in.)
Reading further, I see that the builtin levels range for NOTSET=0 to CRITICAL=50 (15.6.2. Logging Levels), so I think the first quote should be changed to
"Another useful feature of the logging API is the ability to produce different messages at different log levels. This allows you to instrument your code with debug messages, for example, but turning the log level up so that those debug messages are not written for your production system. The default levels are NOTSET, DEBUG, INFO, WARNING, ERROR, and CRITICAL.
The logger, handler, and log message call each specify a level. The log message is only emitted if the handler and logger are configured to emit messages of that level or higher. "
I have not checked the rest of the doc for other backwards passages.