Skip to content

Commit 4f0f9f0

Browse files
drothlisvsajip
authored andcommitted
logging.Formatter docs: Add missing validate parameter, clarify style parameter (GH-15222)
1 parent 9d60706 commit 4f0f9f0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Doc/library/logging.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ The useful mapping keys in a :class:`LogRecord` are given in the section on
528528
:ref:`logrecord-attributes`.
529529

530530

531-
.. class:: Formatter(fmt=None, datefmt=None, style='%')
531+
.. class:: Formatter(fmt=None, datefmt=None, style='%', validate=True)
532532

533533
Returns a new instance of the :class:`Formatter` class. The instance is
534534
initialized with a format string for the message as a whole, as well as a
@@ -538,8 +538,11 @@ The useful mapping keys in a :class:`LogRecord` are given in the section on
538538

539539
The *style* parameter can be one of '%', '{' or '$' and determines how
540540
the format string will be merged with its data: using one of %-formatting,
541-
:meth:`str.format` or :class:`string.Template`. See :ref:`formatting-styles`
542-
for more information on using {- and $-formatting for log messages.
541+
:meth:`str.format` or :class:`string.Template`. This only applies to the
542+
format string *fmt* (e.g. ``'%(message)s'`` or ``{message}``), not to the
543+
actual log messages passed to ``Logger.debug`` etc; see
544+
:ref:`formatting-styles` for more information on using {- and $-formatting
545+
for log messages.
543546

544547
.. versionchanged:: 3.2
545548
The *style* parameter was added.

0 commit comments

Comments
 (0)