Skip to content

logging.Formatter docs: Add missing validate parameter, clarify style parameter #15222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Doc/library/logging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ The useful mapping keys in a :class:`LogRecord` are given in the section on
:ref:`logrecord-attributes`.


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

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
Expand All @@ -538,8 +538,11 @@ The useful mapping keys in a :class:`LogRecord` are given in the section on

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`. See :ref:`formatting-styles`
for more information on using {- and $-formatting for log messages.
:meth:`str.format` or :class:`string.Template`. This only applies to the
format string *fmt* (e.g. ``'%(message)s'`` or ``{message}``), not to the
actual log messages passed to ``Logger.debug`` etc; see
:ref:`formatting-styles` for more information on using {- and $-formatting
for log messages.

.. versionchanged:: 3.2
The *style* parameter was added.
Expand Down