summaryrefslogtreecommitdiff
path: root/Doc/library/logging.rst
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2011-06-12 11:50:40 +0100
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2011-06-12 11:50:40 +0100
commit7760c90a8003e11776826c74e2248bd32f97ffb0 (patch)
tree781541f85b13f335d04c73a0e9c19fd00f4acc90 /Doc/library/logging.rst
parentf7fb46d19cf1a87a768846a9984ff48bacf141e0 (diff)
parent35c289ea57dc2ca95c0fca6b82e73b8f9100d936 (diff)
downloadcpython-7760c90a8003e11776826c74e2248bd32f97ffb0.tar.gz
Merged documentation update for Formatter.formatTime.
Diffstat (limited to 'Doc/library/logging.rst')
-rw-r--r--Doc/library/logging.rst30
1 files changed, 29 insertions, 1 deletions
diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst
index 20cd57c5ae..50704876b2 100644
--- a/Doc/library/logging.rst
+++ b/Doc/library/logging.rst
@@ -461,6 +461,19 @@ The useful mapping keys in a :class:`LogRecord` are given in the section on
want all logging times to be shown in GMT, set the ``converter``
attribute in the ``Formatter`` class.
+ .. versionchanged:: 3.3
+ Previously, the default ISO 8601 format was hard-coded as in this
+ example: ``2010-09-06 22:38:15,292`` where the part before the comma is
+ handled by a strptime format string (``'%Y-%m-%d %H:%M:%S'``), and the
+ part after the comma is a millisecond value. Because strptime does not
+ have a format placeholder for milliseconds, the millisecond value is
+ appended using another format string, ``'%s,%03d'`` – and both of these
+ format strings have been hardcoded into this method. With the change,
+ these strings are defined as class-level attributes which can be
+ overridden at the instance level when desired. The names of the
+ attributes are ``default_time_format`` (for the strptime format string)
+ and ``default_msec_format`` (for appending the millisecond value).
+
.. method:: formatException(exc_info)
Formats the specified exception information (a standard exception tuple as
@@ -993,12 +1006,27 @@ functions.
| ``stream`` | Use the specified stream to initialize the |
| | StreamHandler. Note that this argument is |
| | incompatible with 'filename' - if both are |
- | | present, 'stream' is ignored. |
+ | | present, a ``ValueError`` is raised. |
+ +--------------+---------------------------------------------+
+ | ``handlers`` | If specified, this should be an iterable of |
+ | | already created handlers to add to the root |
+ | | logger. Any handlers which don't already |
+ | | have a formatter set will be assigned the |
+ | | default formatter created in this function. |
+ | | Note that this argument is incompatible |
+ | | with 'filename' or 'stream' - if both are |
+ | | present, a ``ValueError`` is raised. |
+--------------+---------------------------------------------+
.. versionchanged:: 3.2
The ``style`` argument was added.
+ .. versionchanged:: 3.3
+ The ``handlers`` argument was added. Additional checks were added to
+ catch situations where incompatible arguments are specified (e.g.
+ ``handlers`` together with ``stream`` or ``filename``, or ``stream``
+ together with ``filename``).
+
.. function:: shutdown()