@@ -14,14 +14,9 @@ the channel).
1414
1515.. note ::
1616
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 >`.
2520
2621.. _logging-channel-handler :
2722
@@ -180,18 +175,13 @@ inject this service into others, you must update the service configuration to
180175
181176.. _monolog-autowire-channels :
182177
183- How to autowire logger channels
178+ How to Autowire Logger Channels
184179~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
185180
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:
195185
196186.. code-block :: diff
197187
@@ -200,3 +190,5 @@ Now you can remove service configuration at all and change constructor signature
200190 {
201191 $this->logger = $appLogger;
202192 }
193+
194+ .. _`MonologBundle` : https://github.com/symfony/monolog-bundle
0 commit comments