Skip to content

Tell about ProcessorInterface in logging/processors #9996

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
Jul 6, 2018
Merged
Changes from 1 commit
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
22 changes: 22 additions & 0 deletions logging/processors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,28 @@ If you use several handlers, you can also register a processor at the
handler level or at the channel level instead of registering it globally
(see the following sections).

.. tip::

.. versionadded:: 4.2
Processors can be autoconfigured since Symfony 4.2.

Processors implementing :class:`Symfony\\Bridge\\Monolog\\Processor\\ProcessorInterface`
can have their ``monolog.processor`` tag added for you by Symfony when autoconfiguration
is enabled. In this situation, this means creating a processor class might be all you
need do to to have it up and running. It also means enabling the
:class:`Symfony\\Bridge\\Monolog\\Processor\\TokenProcessor` or the
:class:`Symfony\\Bridge\\Monolog\\Processor\\WebProcessor` in your Flex-enabled app is a
one-liner:

.. code-block:: yaml

# config/services.yaml
services:
# Adds the current security token to log entries
Symfony\Bridge\Monolog\Processor\TokenProcessor: ~
# Adds the real client IP to log entries
Symfony\Bridge\Monolog\Processor\WebProcessor: ~

Registering Processors per Handler
----------------------------------

Expand Down