Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: #95044 - Support autowired LoggerInterface injection #4435

Open
simonschaufi opened this issue Oct 30, 2024 · 0 comments
Open

Feature: #95044 - Support autowired LoggerInterface injection #4435

simonschaufi opened this issue Oct 30, 2024 · 0 comments

Comments

@simonschaufi
Copy link
Collaborator

Feature: #95044 - Support autowired LoggerInterface injection

https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/11.4/Feature-95044-SupportAutowiredLoggerInterfaceInjection.html

Feature: #95044 - Support autowired LoggerInterface injection

See 95044

Description

Logger instances may be required to be available during object
construction, LoggerAwareInterface isn't an option in that case.
Therefore \Psr\Log\LoggerInterface 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\Log\LoggerAwareInterface
and \Psr\Log\LoggerAwareTrait, but can add a constructor argument
\Psr\Log\LoggerInterface instead.

Example:

use Psr\Log\LoggerInterface;

class MyClass {
    private LoggerInterface $logger;

    public function __construct(LoggerInterface $logger) {
        $this->logger = $logger;
    }
}

PHP-API, ext:core

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant