2 declare(strict_types
= 1);
4 namespace TYPO3\CMS\Core\Log\Writer
;
7 * This file is part of the TYPO3 CMS project.
9 * It is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License, either version 2
11 * of the License, or any later version.
13 * For the full copyright and license information, please read the
14 * LICENSE.txt file that was distributed with this source code.
16 * The TYPO3 project - inspiring people to share!
19 use TYPO3\CMS\Core\Cache\CacheManager
;
20 use TYPO3\CMS\Core\Utility\GeneralUtility
;
23 * Log writer that writes log entries into TYPO3 runtime cache
25 class RuntimeCacheWriter
implements WriterInterface
29 * Writes the log record to TYPO3s runtime cache
31 * @param \TYPO3\CMS\Core\Log\LogRecord $record Log record
32 * @return \TYPO3\CMS\Core\Log\Writer\WriterInterface $this
35 public function writeLog(\TYPO3\CMS\Core\Log\LogRecord
$record)
37 $cacheManager = GeneralUtility
::makeInstance(CacheManager
::class);
38 $runtimeCache = $cacheManager->getCache('cache_runtime');
39 $component = str_replace('.', '_', $record->getComponent());
40 $runtimeCache->set(sha1(json_encode($record->getData())), $record, [$component]);