Feature: #82441 - Inject logger when creating objects
See forge#82441
Description
Classes that implement \Psr\
automatically
get a logger instance injected when a class instance is created via
General
and Object
.
For developer convenience the \Psr\
can be used.
The trait adds a public set
and a protected $logger
property
to the class, no further code is needed to successfully implement the interface.
A minimal example looks like this (example from a test case fixture):
<?php
declare(strict_types = 1);
namespace TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
class GeneralUtilityMakeInstanceInjectLoggerFixture implements LoggerAwareInterface
{
use LoggerAwareTrait;
}
Copied!