Skip to content

Commit b344f08

Browse files
committed
Reword
1 parent 2062eea commit b344f08

File tree

10 files changed

+16
-77
lines changed

10 files changed

+16
-77
lines changed

bundles/best_practices.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,11 +463,6 @@ to the service id. For example, in MonologBundle, an alias is created from
463463
``Psr\Log\LoggerInterface`` to ``logger`` so that the ``LoggerInterface`` type-hint
464464
can be used for autowiring.
465465

466-
.. versionadded:: 4.2
467-
468-
Since Monolog Bundle 3.5 each channel bind into container by type-hinted alias.
469-
More info in the part about :ref:`how to autowire monolog channels <monolog-autowire-channels>`.
470-
471466
Services should not use autowiring or autoconfiguration. Instead, all services should
472467
be defined explicitly.
473468

console/commands_as_services.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@ the command class will automatically be registered as a service and passed the `
5353
argument (thanks to autowiring). In other words, *just* by creating this class, everything
5454
works! You can call the ``app:sunshine`` command and start logging.
5555

56-
.. versionadded:: 4.2
57-
58-
Since Monolog Bundle 3.5 each channel bind into container by type-hinted alias.
59-
More info in the part about :ref:`how to autowire monolog channels <monolog-autowire-channels>`.
60-
6156
.. caution::
6257

6358
You *do* have access to services in ``configure()``. However, if your command is

controller.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,6 @@ the argument by its name:
275275
])
276276
;
277277
278-
.. versionadded:: 4.2
279-
280-
Since Monolog Bundle 3.5 each channel bind into container by type-hinted alias.
281-
More info in the part about :ref:`how to autowire monolog channels <monolog-autowire-channels>`.
282-
283278
Like with all services, you can also use regular :ref:`constructor injection <services-constructor-injection>`
284279
in your controllers.
285280

logging.rst

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -349,15 +349,10 @@ passed as a service.
349349
was introduced in Symfony 4.2.
350350

351351
If you want to use in your own services a pre-configured logger which uses a
352-
specific channel (``app`` by default), use the ``monolog.logger`` tag with the
353-
``channel`` property as explained in the
352+
specific channel (``app`` by default), you can either :ref:`autowire monolog channels <monolog-autowire-channels>`
353+
or use the ``monolog.logger`` tag with the ``channel`` property as explained in the
354354
:ref:`Dependency Injection reference <dic_tags-monolog>`.
355355

356-
.. versionadded:: 4.2
357-
358-
Since Monolog Bundle 3.5 each channel bind into container by type-hinted alias.
359-
More info in the part about :ref:`how to autowire monolog channels <monolog-autowire-channels>`.
360-
361356
Adding extra Data to each Log (e.g. a unique request token)
362357
-----------------------------------------------------------
363358

logging/channels_handlers.rst

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -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

quick_tour/the_architecture.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ But wait! Something *very* cool just happened. Symfony read the ``LoggerInterfac
5252
type-hint and automatically figured out that it should pass us the Logger object!
5353
This is called *autowiring*.
5454

55-
.. versionadded:: 4.2
56-
57-
Furthermore, since Monolog Bundle 3.5 each channel bind into container by type-hinted alias.
58-
More info in the part about :ref:`how to autowire monolog channels <monolog-autowire-channels>`.
59-
6055
Every bit of work that's done in a Symfony app is done by an *object*: the Logger
6156
object logs things and the Twig object renders templates. These objects are called
6257
*services* and they are *tools* that help you build rich features.

reference/configuration/monolog.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ The MonologBundle integrates the Monolog :doc:`logging </logging>` library in
88
Symfony applications. All these options are configured under the ``monolog`` key
99
in your application configuration.
1010

11-
.. versionadded:: 4.2
12-
13-
Since Monolog Bundle 3.5 each channel bind into container by type-hinted alias.
14-
More info in the part about :ref:`how to autowire monolog channels <monolog-autowire-channels>`.
15-
1611
.. code-block:: terminal
1712
1813
# displays the default config values defined by Symfony

reference/dic_tags.rst

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -530,14 +530,8 @@ channel when injecting the logger in a service.
530530
531531
.. tip::
532532

533-
You can also configure custom channels in the configuration and retrieve
534-
the corresponding logger service from the service container directly (see
535-
:ref:`monolog-channels-config`).
536-
537-
.. versionadded:: 4.2
538-
539-
Since Monolog Bundle 3.5 each channel bind into container by type-hinted alias.
540-
More info in the part about :ref:`how to autowire monolog channels <monolog-autowire-channels>`.
533+
You can create :doc:`custom channels </logging/channels_handlers>` and
534+
even :ref:`autowire logging channels <monolog-autowire-channels>`.
541535

542536
.. _dic_tags-monolog-processor:
543537

service_container.rst

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -616,13 +616,6 @@ But, you can control this and pass in a different logger:
616616
This tells the container that the ``$logger`` argument to ``__construct`` should use
617617
service whose id is ``monolog.logger.request``.
618618

619-
.. versionadded:: 4.2
620-
621-
Since Monolog Bundle 3.5 each channel already into container by type-hinted alias.
622-
Instead of explicit declare configuration ``$logger: '@monolog.logger.request'``
623-
just use variable in the constructor signature: ``Psr\Log\LoggerInterface $requestLogger``.
624-
More info in the part about :ref:`how to autowire monolog channels <monolog-autowire-channels>`.
625-
626619
.. _container-debug-container:
627620

628621
For a full list of *all* possible services in the container, run:
@@ -721,11 +714,6 @@ argument for *any* service defined in this file! You can bind arguments by name
721714
(e.g. ``$adminEmail``), by type (e.g. ``Psr\Log\LoggerInterface``) or both
722715
(e.g. ``Psr\Log\LoggerInterface $requestLogger``).
723716

724-
.. versionadded:: 4.2
725-
726-
Since Monolog Bundle 3.5 each channel already bind into container by type-hinted alias.
727-
More info in the part about :ref:`how to autowire monolog channels <monolog-autowire-channels>`.
728-
729717
The ``bind`` config can also be applied to specific services or when loading many
730718
services at once (i.e. :ref:`service-psr4-loader`).
731719

service_container/3.3-di-changes.rst

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,8 @@ create the class::
392392
}
393393

394394
Great! In Symfony 3.2 or lower, you would now need to register this as a service
395-
in ``services.yaml`` and tag it with ``kernel.event_subscriber``.
396-
In Symfony 3.3, you're already done!
397-
398-
.. versionadded:: 4.2
399-
400-
Furthermore, since Monolog Bundle 3.5 each channel bind into container by type-hinted alias.
401-
More info in the part about :ref:`how to autowire monolog channels <monolog-autowire-channels>`.
395+
in ``services.yaml`` and tag it with ``kernel.event_subscriber``. In Symfony 3.3,
396+
you're already done!
402397

403398
The service is :ref:`automatically registered <service-33-changes-automatic-registration>`.
404399
And thanks to ``autoconfigure``, Symfony automatically tags the service because

0 commit comments

Comments
 (0)