Skip to content
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
gh-102582: Fix invalid JSON in Doc/howto/logging-cookbook.rst (GH-102635
)

(cherry picked from commit d835b3f)

Co-authored-by: Matěj Cepl <mcepl@cepl.eu>
  • Loading branch information
mcepl authored and miss-islington committed Mar 29, 2023
commit 5527e7041c696a791f2a21bc86daab5ad41d2cd3
24 changes: 14 additions & 10 deletions Doc/howto/logging-cookbook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -340,23 +340,27 @@ adding a ``filters`` section parallel to ``formatters`` and ``handlers``:

.. code-block:: json

"filters": {
"warnings_and_below": {
"()" : "__main__.filter_maker",
"level": "WARNING"
{
"filters": {
"warnings_and_below": {
"()" : "__main__.filter_maker",
"level": "WARNING"
}
}
}

and changing the section on the ``stdout`` handler to add it:

.. code-block:: json

"stdout": {
"class": "logging.StreamHandler",
"level": "INFO",
"formatter": "simple",
"stream": "ext://sys.stdout",
"filters": ["warnings_and_below"]
{
"stdout": {
"class": "logging.StreamHandler",
"level": "INFO",
"formatter": "simple",
"stream": "ext://sys.stdout",
"filters": ["warnings_and_below"]
}
}

A filter is just a function, so we can define the ``filter_maker`` (a factory
Expand Down