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
24 * @deprecated Deprecated since TYPO3 9, will be removed in v10
26 class RuntimeCacheWriter
implements WriterInterface
28 public function __construct()
31 'RuntimeCacheWriter is deprecated, write your own custom InMemoryLogger instead.',
37 * Writes the log record to TYPO3s runtime cache
39 * @param \TYPO3\CMS\Core\Log\LogRecord $record Log record
40 * @return \TYPO3\CMS\Core\Log\Writer\WriterInterface $this
43 public function writeLog(\TYPO3\CMS\Core\Log\LogRecord
$record)
45 $cacheManager = GeneralUtility
::makeInstance(CacheManager
::class);
46 $runtimeCache = $cacheManager->getCache('cache_runtime');
47 $component = str_replace('.', '_', $record->getComponent());
48 $runtimeCache->set(sha1(json_encode($record->getData())), $record, [$component]);