[Python-checkins] cpython (2.7): Issue #19902: Added list of logging levels.

vinay.sajip python-checkins at python.org
Thu Dec 19 12:51:35 CET 2013


http://hg.python.org/cpython/rev/16bfddf5a091
changeset: 88052:16bfddf5a091
branch: 2.7
parent: 88049:c0dc1400866a
user: Vinay Sajip <vinay_sajip at yahoo.co.uk>
date: Thu Dec 19 11:42:18 2013 +0000
summary:
 Issue #19902: Added list of logging levels.
files:
 Doc/library/logging.rst | 32 +++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst
--- a/Doc/library/logging.rst
+++ b/Doc/library/logging.rst
@@ -114,6 +114,8 @@
 If the root is reached, and it has a level of NOTSET, then all messages will be
 processed. Otherwise, the root's level will be used as the effective level.
 
+ See :ref:`levels` for a list of levels.
+
 
 .. method:: Logger.isEnabledFor(lvl)
 
@@ -281,6 +283,35 @@
 .. versionchanged:: 2.5
 *func* and *extra* were added.
 
+
+.. _levels:
+
+Logging Levels
+--------------
+
+The numeric values of logging levels are given in the following table. These are
+primarily of interest if you want to define your own levels, and need them to
+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 |
++==============+===============+
+| ``CRITICAL`` | 50 |
++--------------+---------------+
+| ``ERROR`` | 40 |
++--------------+---------------+
+| ``WARNING`` | 30 |
++--------------+---------------+
+| ``INFO`` | 20 |
++--------------+---------------+
+| ``DEBUG`` | 10 |
++--------------+---------------+
+| ``NOTSET`` | 0 |
++--------------+---------------+
+
+
 .. _handler:
 
 Handler Objects
@@ -321,6 +352,7 @@
 severe than *lvl* will be ignored. When a handler is created, the level is set
 to :const:`NOTSET` (which causes all messages to be processed).
 
+ See :ref:`levels` for a list of levels.
 
 .. method:: Handler.setFormatter(form)
 
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /