3declare(strict_types=1);
14use Psr\Log\LoggerInterface;
15use TYPO3\CMS\Core\Log\LogManagerInterface;
16use TYPO3\CMS\Core\Log\Writer\DatabaseWriter;
17use TYPO3\CMS\Core\Log\Writer\FileWriter;
18use TYPO3\CMS\Core\SingletonInterface;
19use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
20use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
66 public function getLogger(
string $name): LoggerInterface
69 $writerConfiguration = $GLOBALS[
'TYPO3_CONF_VARS'][
'LOG'][
'Thucke'][
'Timezones'][
'writerConfiguration'];
70 $settings = $this->configurationManager->getConfiguration(
71 ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS,
75 if (is_array($settings[
'logging'])) {
76 foreach ($settings[
'logging'] as $logLevel => $logConfig) {
77 $levelUppercase = strtoupper($logLevel);
78 if (!empty($logConfig[
'file'])) {
79 $writerConfiguration[constant(
'\TYPO3\CMS\Core\Log\LogLevel::' . $levelUppercase)][FileWriter::class] =
80 [
'logFile' => $logConfig[
'file']];
82 if (!empty($logConfig[
'database'])) {
83 $writerConfiguration[constant(
'\TYPO3\CMS\Core\Log\LogLevel::' . $levelUppercase)][DatabaseWriter::class] =
84 [
'table' => $logConfig[
'table']];
88 $GLOBALS[
'TYPO3_CONF_VARS'][
'LOG'][
'Thucke'][
'Timezones'][
'writerConfiguration'] = $writerConfiguration;
89 return $this->logManager->getLogger($name);
injectConfigurationManager(ConfigurationManagerInterface $configurationManager)
injectLogManager(LogManagerInterface $logManager)