]> granicus.if.org Git - python/commitdiff
Issue #19902: Added list of logging levels.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Thu, 19 Dec 2013 11:42:18 +0000 (11:42 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Thu, 19 Dec 2013 11:42:18 +0000 (11:42 +0000)
Doc/library/logging.rst

index 68e359e61a34278cba8988bc3038e4031e9c7a4f..e8189c2ecef3e546efdbab9d16a97f4449cb455f 100644 (file)
@@ -114,6 +114,8 @@ is the module's name in the Python package namespace.
    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 @@ is the module's name in the Python package namespace.
    .. 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 @@ subclasses. However, the :meth:`__init__` method in subclasses needs to call
    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)