Skip to content

Commit 426784e

Browse files
committed
minor #11825 [Logger] [Processor] additional info on processor (noniagriconomie)
This PR was squashed before being merged into the 4.3 branch (closes #11825). Discussion ---------- [Logger] [Processor] additional info on processor Hi, I was reading doc around log/monolog and testing some features (processor here). I think this is an addition to have in the doc. Edit : I also have a question, I can see that monolog, which is the main php logger lib, is not "actively maintained", maybe the maintainer(s) are busy on other projects which is normal Question is: do you think it can be included as it is as a symfony component ? so that it can get more visibility/documentation and so community maintainers just asking like that :) Commits ------- 38f5ed7 [Logger] [Processor] additional info on processor
2 parents 1844867 + 38f5ed7 commit 426784e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

logging/processors.rst

Lines changed: 10 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,8 @@ using a processor::
3030
$this->session = $session;
3131
}
3232

33+
// This method is called for each log record and process it.
34+
// Keep it optimized process, to not introduce any overhead.
3335
public function __invoke(array $record)
3436
{
3537
if (!$this->session->isStarted()) {
@@ -184,6 +186,9 @@ Symfony's MonologBridge provides processors that can be registered inside your a
184186
The ``RouteProcessor`` and the ``ConsoleCommandProcessor`` were introduced
185187
in Symfony 4.3.
186188

189+
Monolog_ also have built in processors ready to use inside your application.
190+
Read the librairy documentation to learn more.
191+
187192
Registering Processors per Handler
188193
----------------------------------
189194

@@ -271,3 +276,5 @@ the ``monolog.processor`` tag:
271276
$container
272277
->register(SessionRequestProcessor::class)
273278
->addTag('monolog.processor', ['channel' => 'main']);
279+
280+
.. _Monolog: https://github.com/Seldaek/monolog

0 commit comments

Comments
 (0)