Feature: #95044 - Support autowired LoggerInterface injection¶
See forge#95044
Description¶
Logger instances may be required to be available during object
construction, LoggerAwareInterface isn't an option in that case.
Therefore \Psr\
as constructor argument
is now autowired (if the service is configured to use autowiring)
and instantiated with an object-specific logger.
Impact¶
Services are no longer required to use
\Psr\
and \Psr\
,
but can add a constructor argument \Psr\
instead.
Example:
use Psr\Log\LoggerInterface;
class MyClass {
private LoggerInterface $logger;
public function __construct(LoggerInterface $logger) {
$this->logger = $logger;
}
}
Copied!