@@ -14,14 +14,9 @@ the channel).
14
14
15
15
.. note ::
16
16
17
- Each channel corresponds to a logger service (``monolog.logger.XXX ``)
18
- in the container (use the ``php bin/console debug:container monolog `` command
19
- to see a full list) and those are injected into different services.
20
-
21
- .. versionadded :: 4.2
22
-
23
- Since Monolog Bundle 3.5 each channel bind into container by type-hinted alias.
24
- More info in the part about :ref: `how to autowire monolog channels <monolog-autowire-channels >`.
17
+ Each channel corresponds to a different logger service (``monolog.logger.XXX ``)
18
+ Use the ``php bin/console debug:container monolog `` command to see a full
19
+ list of services and learn :ref: `how to autowire monolog channels <monolog-autowire-channels >`.
25
20
26
21
.. _logging-channel-handler :
27
22
@@ -180,18 +175,13 @@ inject this service into others, you must update the service configuration to
180
175
181
176
.. _monolog-autowire-channels :
182
177
183
- How to autowire logger channels
178
+ How to Autowire Logger Channels
184
179
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
185
180
186
- .. versionadded :: 4.2
187
-
188
- This feature available since MonologBundle 3.5
189
-
190
- Each channel already bind into container by type-hinted alias.
191
- Just use method variables, which follows next naming template ``Psr\Log\LoggerInterface $<channel>Logger ``.
192
- For example, you have ``App\Log\CustomLogger `` service which tagged by ``app `` logger channel
193
- as described in part :ref: `Logging with a custom logging channel <dic_tags-monolog >`.
194
- Now you can remove service configuration at all and change constructor signature:
181
+ Starting from `MonologBundle `_ 3.5 you can autowire different Monolog channels
182
+ by type-hinting your service arguments with the following syntax:
183
+ ``Psr\Log\LoggerInterface $<channel>Logger ``. For example, to inject the service
184
+ related to the ``app `` logger channel use this:
195
185
196
186
.. code-block :: diff
197
187
@@ -200,3 +190,5 @@ Now you can remove service configuration at all and change constructor signature
200
190
{
201
191
$this->logger = $appLogger;
202
192
}
193
+
194
+ .. _`MonologBundle` : https://github.com/symfony/monolog-bundle
0 commit comments