|
1 | 1 | How to Add extra Data to Log Messages via a Processor |
2 | 2 | ===================================================== |
3 | 3 |
|
4 | | -Monolog allows you to process every record before logging it by adding some |
| 4 | +`Monolog`_ allows you to process every record before logging it by adding some |
5 | 5 | extra data. This is the role of a processor, which can be applied for the whole |
6 | 6 | handler stack or only for a specific handler or channel. |
7 | 7 |
|
@@ -30,8 +30,7 @@ using a processor:: |
30 | 30 | $this->session = $session; |
31 | 31 | } |
32 | 32 |
|
33 | | - // This method is called for each log record and process it. |
34 | | - // Keep it optimized process, to not introduce any overhead. |
| 33 | + // this method is called for each log record; optimize it to not hurt performance |
35 | 34 | public function __invoke(array $record) |
36 | 35 | { |
37 | 36 | if (!$this->session->isStarted()) { |
@@ -186,8 +185,10 @@ Symfony's MonologBridge provides processors that can be registered inside your a |
186 | 185 | The ``RouteProcessor`` and the ``ConsoleCommandProcessor`` were introduced |
187 | 186 | in Symfony 4.3. |
188 | 187 |
|
189 | | -Monolog_ also have built in processors ready to use inside your application. |
190 | | -Read the librairy documentation to learn more. |
| 188 | +.. seealso:: |
| 189 | + |
| 190 | + Check out the `built-in Monolog processors`_ to learn more about how to |
| 191 | + create these processors. |
191 | 192 |
|
192 | 193 | Registering Processors per Handler |
193 | 194 | ---------------------------------- |
@@ -277,4 +278,5 @@ the ``monolog.processor`` tag: |
277 | 278 | ->register(SessionRequestProcessor::class) |
278 | 279 | ->addTag('monolog.processor', ['channel' => 'main']); |
279 | 280 |
|
280 | | -.. _Monolog: https://github.com/Seldaek/monolog |
| 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