Skip to content

gh-107877: Update logging levels reference table with usage criteria. #107894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 33 additions & 15 deletions Doc/library/logging.rst
Copy link
Member

@AlexWaygood AlexWaygood Aug 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could consider converting the table into a list-table, like we use in the typing docs here:

.. list-table::

It might make it easier to maintain it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion - perhaps not worth changing it again now for this specific instance, but I'll bear in mind when creating tables in future!

Original file line number Diff line number Diff line change
Expand Up @@ -397,21 +397,39 @@ have specific values relative to the predefined levels. If you define a level
with the same numeric value, it overwrites the predefined value; the predefined
name is lost.

+-----------------------+---------------+
| Level | Numeric value |
+=======================+===============+
| .. py:data:: CRITICAL | 50 |
+-----------------------+---------------+
| .. py:data:: ERROR | 40 |
+-----------------------+---------------+
| .. py:data:: WARNING | 30 |
+-----------------------+---------------+
| .. py:data:: INFO | 20 |
+-----------------------+---------------+
| .. py:data:: DEBUG | 10 |
+-----------------------+---------------+
| .. py:data:: NOTSET | 0 |
+-----------------------+---------------+
+-----------------------+---------------+-------------------------------------+
| Level | Numeric value | What it means / When to use it |
+=======================+===============+=====================================+
| .. py:data:: NOTSET | 0 | When set on a logger, indicates that|
| | | ancestor loggers are to be consulted|
| | | to determine the effective level. |
| | | If that still resolves to |
| | | :const:`!NOTSET`, then all events |
| | | are logged. When set on a handler, |
| | | all events are handled. |
+-----------------------+---------------+-------------------------------------+
| .. py:data:: DEBUG | 10 | Detailed information, typically only|
| | | of interest to a developer trying to|
| | | diagnose a problem. |
+-----------------------+---------------+-------------------------------------+
| .. py:data:: INFO | 20 | Confirmation that things are working|
| | | as expected. |
+-----------------------+---------------+-------------------------------------+
| .. py:data:: WARNING | 30 | An indication that something |
| | | unexpected happened, or that a |
| | | problem might occur in the near |
| | | future (e.g. 'disk space low'). The |
| | | software is still working as |
| | | expected. |
+-----------------------+---------------+-------------------------------------+
| .. py:data:: ERROR | 40 | Due to a more serious problem, the |
| | | software has not been able to |
| | | perform some function. |
+-----------------------+---------------+-------------------------------------+
| .. py:data:: CRITICAL | 50 | A serious error, indicating that the|
| | | program itself may be unable to |
| | | continue running. |
+-----------------------+---------------+-------------------------------------+


.. _handler:
Expand Down