]> granicus.if.org Git - python/commitdiff
Merged documentation update for Formatter.formatTime.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Sun, 12 Jun 2011 10:50:40 +0000 (11:50 +0100)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Sun, 12 Jun 2011 10:50:40 +0000 (11:50 +0100)
1  2 
Doc/library/logging.rst

index 5df080563f0f678593fba947675765b2658e1cf6,20cd57c5ae203ebae6219dc5e3fa19342e637e33..50704876b2c6ef896dd3dd4330be08b72c9cdeb7
@@@ -453,19 -453,14 +453,27 @@@ The useful mapping keys in a :class:`Lo
        record. Otherwise, the ISO8601 format is used.  The resulting string is
        returned.
  
+       This function uses a user-configurable function to convert the creation
+       time to a tuple. By default, :func:`time.localtime` is used; to change
+       this for a particular formatter instance, set the ``converter`` attribute
+       to a function with the same signature as :func:`time.localtime` or
+       :func:`time.gmtime`. To change it for all formatters, for example if you
+       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