diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2011-04-08 00:30:51 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2011-04-08 00:30:51 (GMT) |
commit | c46102c98a6866a76a448e504b25a2814a234dd8 (patch) | |
tree | 8eff1feeef3c024bcb82b8e2b4988e51894622b5 | |
parent | 2e3607c1e758865519b28066b8925f37203e2197 (diff) | |
download | cpython-c46102c98a6866a76a448e504b25a2814a234dd8.zip cpython-c46102c98a6866a76a448e504b25a2814a234dd8.tar.gz cpython-c46102c98a6866a76a448e504b25a2814a234dd8.tar.bz2 |
Updated Formatter documentation.
-rw-r--r-- | Doc/library/logging.rst | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst index e02556b..b94951d 100644 --- a/Doc/library/logging.rst +++ b/Doc/library/logging.rst @@ -405,7 +405,7 @@ The useful mapping keys in a :class:`LogRecord` are given in the section on :ref:`logrecord-attributes`. -.. 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 @@ -413,6 +413,14 @@ The useful mapping keys in a :class:`LogRecord` are given in the section on 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 @@ -691,7 +699,6 @@ LoggerAdapter Objects 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 |