8000 gh-93162: Add ability to configure QueueHandler/QueueListener together and provide getHandlerByName() and getHandlerNames() APIs. by vsajip · Pull Request #93269 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-93162: Add ability to configure QueueHandler/QueueListener together and provide getHandlerByName() and getHandlerNames() APIs. #93269

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 8 commits into from
Jun 7, 2022
Prev Previous commit
Correct typos in documentation.
  • Loading branch information
vsajip committed May 31, 2022
commit a29ded8205dc31a64c897a1f8ee9204438cf6515
17 changes: 9 additions & 8 deletions Doc/library/logging.config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -669,10 +669,11 @@ Configuring QueueHandler and QueueListener
If you want to configure a :class:`~logging.handlers.QueueHandler`, noting that this
is normally used in conjunction with a :class:`~logging.handlers.QueueListener`, you
can configure both together. After the configuration, the ``QueueListener`` instance
will be available as the :attr:`listener` attribute of the created handler, and that
in turn will be available to you using :func:`~logging.getHandlerByName` and passing
the name you have used for the ``QueueHandler`` in your configuration. The
dictionary schema for configuring the pair is shown in the example YAML snippet below.
will be available as the :attr:`~logging.handlers.QueueHandler.listener` attribute of
the created handler, and that in turn will be available to you using
:func:`~logging.getHandlerByName` and passing the name you have used for the
``QueueHandler`` in your configuration. The dictionary schema for configuring the pair
is shown in the example YAML snippet below.

.. code-block:: yaml

Expand All @@ -697,9 +698,9 @@ If the ``queue`` key is present, the corresponding value can be one of the follo
* A string that resolves to a callable which, when called with no arguments, returns
the :class:`queue.Queue` instance to use. That callable could be a
:class:`queue.Queue` subclass or a function which returns a suitable queue instance,
such as :func:`my.module.queue_factory`.
such as ``my.module.queue_factory()``.

* A dict with a ``()`` key which is constructed in the usual way as discussed in
* A dict with a ``'()'`` key which is constructed in the usual way as discussed in
:ref:`logging-config-dict-userdef`. The result of this construction should be a
:class:`queue.Queue` instance.

Expand All @@ -713,9 +714,9 @@ If the ``listener`` key is present, the corresponding value can be one of the fo
code.

* A string which resolves to a class which is a subclass of ``QueueListener``, such as
``'my,package.CustomListener'``.
``'my.package.CustomListener'``.

* A dict with a ``()`` key which is constructed in the usual way as discussed in
* A dict with a ``'()'`` key which is constructed in the usual way as discussed in
:ref:`logging-config-dict-userdef`. The result of this construction should be a
callable with the same signature as the ``QueueListener`` initializer.

Expand Down
0