Feature: #82441 - Inject logger when creating objects

See Issue #82441

Description

Classes that implement \Psr\Log\LoggerAwareInterface automatically get a logger instance injected when a class instance is created via GeneralUtility::makeInstance() and ObjectManger::get() .

For developer convenience the \Psr\Log\LoggerAwareTrait can be used. The trait adds a public setLogger() 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;
}