diff --git a/logging/channels_handlers.rst b/logging/channels_handlers.rst index f149f31c7e0..1b57976ad2b 100644 --- a/logging/channels_handlers.rst +++ b/logging/channels_handlers.rst @@ -172,3 +172,11 @@ need to tag your services: With this, you can now send log messages to the ``foo`` channel by using the automatically registered logger service ``monolog.logger.foo``. + +.. configuration-block:: + + .. code-block:: php + + // src/Controller/MainController.php + $logger = $this->get('monolog.logger.foo'); + $logger->info('foobar');