Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3b0b8f6

Browse files
committed
minor #9996 Tell about ProcessorInterface in logging/processors (nicolas-grekas, javiereguiluz)
This PR was merged into the master branch. Discussion ---------- Tell about ProcessorInterface in logging/processors Doc for symfony/symfony#27801 Commits ------- ad2bad9 Minor reword 0c9c90f Tell about ProcessorInterface in logging/processors
2 parents 655488c + ad2bad9 commit 3b0b8f6

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+
The autoconfiguration of Monolog processors was introduced in Symfony 4.2.
166+
167+
If you're using the :ref:`default services.yaml configuration <service-container-services-load-example>`,
168+
processors implementing :class:`Symfony\\Bridge\\Monolog\\Processor\\ProcessorInterface`
169+
are automatically registered as services and tagged with ``monolog.processor``,
170+
so you can use them without adding any configuration. The same applies to the
171+
built-in :class:`Symfony\\Bridge\\Monolog\\Processor\\TokenProcessor` and
172+
:class:`Symfony\\Bridge\\Monolog\\Processor\\WebProcessor` processors, which
173+
can be enabled as follows:
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)