8000 Tell about ProcessorInterface in logging/processors · symfony/symfony-docs@0c9c90f · GitHub
[go: up one dir, main page]

Skip to content

Commit 0c9c90f

Browse files
Tell about ProcessorInterface in logging/processors
1 parent 4ea4efe commit 0c9c90f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

logging/processors.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,28 @@ If you use several handlers, you can also register a processor at the
159159
handler level or at the channel level instead of registering it globally
160160
(see the following sections).
161161

162+
.. tip::
163+
164+
.. versionadded:: 4.2
165+
Processors can be autoconfigured since Symfony 4.2.
166+
167+
Processors implementing :class:`Symfony\\Bridge\\Monolog\\Processor\\ProcessorInterface`
168+
can have their ``monolog.processor`` tag added for you by Symfony when autoconfiguration
169+
is enabled. In this situation, this means creating a processor class might be all you
170+
need do to to have it up and running. It also means enabling the
171+
:class:`Symfony\\Bridge\\Monolog\\Processor\\TokenProcessor` or the
172+
:class:`Symfony\\Bridge\\Monolog\\Processor\\WebProcessor` in your Flex-enabled app is a
173+
one-liner:
174+
175+
.. code-block:: yaml
176+
177+
# config/services.yaml
178+
services:
179+
# Adds the current security token to log entries
180+
Symfony\Bridge\Monolog\Processor\TokenProcessor: ~
181+
# Adds the real client IP to log entries
182+
Symfony\Bridge\Monolog\Processor\WebProcessor: ~
183+
162184
Registering Processors per Handler
163185
----------------------------------
164186

0 commit comments

Comments
 (0)
0