@@ -159,58 +159,6 @@ If you use several handlers, you can also register a processor at the
159
159
handler level or at the channel level instead of registering it globally
160
160
(see the following sections).
161
161
162
- .. tip ::
163
-
164
- .. versionadded :: 2.4
165
- The autoconfiguration of Monolog processors was introduced in Monolog bundle 2.4.
166
-
167
- If you're using the :ref: `default services.yaml configuration <service-container-services-load-example >`,
168
- processors implementing :class: `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
- .. configuration-block ::
176
-
177
- .. code-block :: yaml
178
-
179
- # config/services.yaml
180
- services :
181
- # Adds the current security token to log entries
182
- Symfony\Bridge\Monolog\Processor\TokenProcessor : ~
183
- # Adds the real client IP to log entries
184
- Symfony\Bridge\Monolog\Processor\WebProcessor : ~
185
-
186
- .. code-block :: xml
187
-
188
- <!-- config/services.xml -->
189
- <?xml version =" 1.0" encoding =" UTF-8" ?>
190
- <container xmlns =" http://symfony.com/schema/dic/services"
191
- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
192
- xsi : schemaLocation =" http://symfony.com/schema/dic/services
193
- http://symfony.com/schema/dic/services/services-1.0.xsd" >
194
-
195
- <services >
196
- <!-- Adds the current security token to log entries -->
197
- <service id =" Symfony\Bridge\Monolog\Processor\TokenProcessor" />
198
- <!-- Adds the real client IP to log entries -->
199
- <service id =" Symfony\Bridge\Monolog\Processor\WebProcessor" />
200
- </services >
201
- </container >
202
-
203
-
B866
.. code-block :: php
204
-
205
- // config/services.php
206
- use Symfony\Bridge\Monolog\Processor\TokenProcessor;
207
- use Symfony\Bridge\Monolog\Processor\WebProcessor;
208
-
209
- // Adds the current security token to log entries
210
- $container->register(TokenProcessor::class);
211
- // Adds the real client IP to log entries
212
- $container->register(WebProcessor::class);
213
-
214
162
Registering Processors per Handler
215
163
----------------------------------
216
164
@@ -298,3 +246,5 @@ the ``monolog.processor`` tag:
298
246
$container
299
247
->register(SessionRequestProcessor::class)
300
248
->addTag('monolog.processor', array('channel' => 'main'));
249
+
250
+ .. _ProcessorInterface : https://github.com/Seldaek/monolog/blob/master/src/Monolog/Processor/ProcessorInterface.php
0 commit comments