Skip to content

Commit 6a2d5cd

Browse files
committed
Merge branch '4.3' into 4.4
* 4.3: [Logger] [Processor] additional info on processor
2 parents b607ee3 + ebab375 commit 6a2d5cd

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

logging/processors.rst

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
How to Add extra Data to Log Messages via a Processor
22
=====================================================
33

4-
Monolog allows you to process the record before logging it to add some
5-
extra data. A processor can be applied for the whole handler stack or
6-
only for a specific handler.
4+
`Monolog`_ allows you to process every record before logging it by adding some
5+
extra data. This is the role of a processor, which can be applied for the whole
6+
handler stack or only for a specific handler or channel.
77

88
A processor is a callable receiving the record as its first argument.
99
Processors are configured using the ``monolog.processor`` DIC tag. See the
@@ -30,6 +30,7 @@ using a processor::
3030
$this->session = $session;
3131
}
3232

33+
// this method is called for each log record; optimize it to not hurt performance
3334
public function __invoke(array $record)
3435
{
3536
if (!$this->session->isStarted()) {
@@ -184,6 +185,11 @@ Symfony's MonologBridge provides processors that can be registered inside your a
184185
The ``RouteProcessor`` and the ``ConsoleCommandProcessor`` were introduced
185186
in Symfony 4.3.
186187

188+
.. seealso::
189+
190+
Check out the `built-in Monolog processors`_ to learn more about how to
191+
create these processors.
192+
187193
Registering Processors per Handler
188194
----------------------------------
189195

@@ -271,3 +277,6 @@ the ``monolog.processor`` tag:
271277
$container
272278
->register(SessionRequestProcessor::class)
273279
->addTag('monolog.processor', ['channel' => 'main']);
280+
281+
.. _`Monolog`: https://github.com/Seldaek/monolog
282+
.. _`built-in Monolog processors`: https://github.com/Seldaek/monolog/tree/master/src/Monolog/Processor

0 commit comments

Comments
 (0)