mirror of
https://github.com/python/cpython.git
synced 2026-01-06 07:22:09 +00:00
bpo-34844: logging.Formatter enhancement - Ensure style and format string matches in logging.Formatter (GH-9703)
This commit is contained in:
parent
e890421e33
commit
18fb1fb943
6 changed files with 403 additions and 22 deletions
|
|
@ -226,6 +226,11 @@ otherwise, the context is used to determine what to instantiate.
|
|||
(with defaults of ``None``) and these are used to construct a
|
||||
:class:`~logging.Formatter` instance.
|
||||
|
||||
.. versionchanged:: 3.8
|
||||
a ``validate`` key (with default of ``True``) can be added into
|
||||
the ``formatters`` section of the configuring dict, this is to
|
||||
validate the format.
|
||||
|
||||
* *filters* - the corresponding value will be a dict in which each key
|
||||
is a filter id and each value is a dict describing how to configure
|
||||
the corresponding Filter instance.
|
||||
|
|
|
|||
|
|
@ -544,6 +544,10 @@ The useful mapping keys in a :class:`LogRecord` are given in the section on
|
|||
.. versionchanged:: 3.2
|
||||
The *style* parameter was added.
|
||||
|
||||
.. versionchanged:: 3.8
|
||||
The *validate* parameter was added. Incorrect or mismatched style and fmt
|
||||
will raise a ``ValueError``.
|
||||
For example: ``logging.Formatter('%(asctime)s - %(message)s', style='{')``.
|
||||
|
||||
.. method:: format(record)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue