Start your All-Access Pass to unlock this challenge
Challenge 1 / 1
You're working with an API and need to log some important data. Your coworker told you that he configured a special API logger, so you need to use that one in order to log anything related to the API. The bin/console debug:autowiring
outputs shows:
Autowirable Types
=================
The following classes & interfaces can be used as type-hints when autowiring:
App\Kernel (kernel)
Describes a logger instance.
Psr\Log\LoggerInterface (monolog.logger)
Psr\Log\LoggerInterface $apiLogger (monolog.logger.api)
Psr\Log\LoggerInterface $deprecationLogger (monolog.logger.deprecation)
Psr\Log\LoggerInterface $translationLogger (monolog.logger.translation)
Interface for mailers able to send emails synchronous and/or asynchronous.
Symfony\Component\Mailer\MailerInterface (mailer.mailer)
Symfony\Component\Serializer\Encoder\DecoderInterface (debug.serializer)
Symfony\Component\Serializer\Encoder\EncoderInterface (debug.serializer)
Stores the Twig configuration and renders templates.
Twig\Environment (twig)
...
725 more concrete services would be displayed when adding the "--all" option.
How could you inject the API logger into the api()
controller?
Skip challenges and go to theNext Chapter