[Python-checkins] cpython: Updated Formatter.formatTime docs to indicate configuration via class

vinay.sajip python-checkins at python.org
Fri Jun 10 20:05:23 CEST 2011


http://hg.python.org/cpython/rev/e572a97a1bd1
changeset:   70775:e572a97a1bd1
user:        Vinay Sajip <vinay_sajip at yahoo.co.uk>
date:        Fri Jun 10 19:05:16 2011 +0100
summary:
  Updated Formatter.formatTime docs to indicate configuration via class attributes.

files:
  Doc/library/logging.rst |  12 ++++++++++++
  1 files changed, 12 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
@@ -453,6 +453,18 @@
       record. Otherwise, the ISO8601 format is used.  The resulting string is
       returned.
 
+      .. 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)
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list