Vinay Sajip  committed c760390

Updated Formatter documentation.

  • Participants
  • Parent commits 225400c
  • Branches 3.2

Comments (0)

Files changed (1)

File Doc/library/logging.rst

-.. class:: Formatter(fmt=None, datefmt=None)
+.. class:: Formatter(fmt=None, datefmt=None, style='%')
    Returns a new instance of the :class:`Formatter` class.  The instance is
    initialized with a format string for the message as a whole, as well as a
    specified, ``'%(message)s'`` is used.  If no *datefmt* is specified, the
    ISO8601 date format is used.
+   The *style* parameter can be one of '%', '{' or '$' and determines how
+   the format string will be merged with its data: using one of %-formatting,
+   :meth:`str.format` or :class:`string.Template`. 
+   .. versionchanged:: 3.2
+      The *style* parameter was added.
    .. method:: format(record)
       The record's attribute dictionary is used as the operand to a string
 information into logging calls. For a usage example , see the section on
 :ref:`adding contextual information to your logging output <context-info>`.
 .. class:: LoggerAdapter(logger, extra)
    Returns an instance of :class:`LoggerAdapter` initialized with an