ssch / t3-psr3-log-processor
Provide PSR-3 interpolate log processor
Fund package maintenance!
sabbelasichon
paypal.me/schreiberten
Installs: 1 700
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 3
Forks: 0
Open Issues: 3
Type:typo3-cms-extension
Requires
- php: ^7.4 || ^8.0
- typo3/cms-core: ^10.4 || ^11.5 || ^12.1
Requires (Dev)
Replaces
- typo3-ter/t3-psr3-log-processor: v1.0.0
This package is auto-updated.
Last update: 2024-10-31 00:34:09 UTC
README
https://www.php-fig.org/psr/psr-3/#12-message
Integration guide
The extension ships with a custom Processor to substitute log messages with context variables in the message. Let´s say you have a log message with the following format:
use Psr\Log\LogLevel;use TYPO3\CMS\Core\Log\LogRecord; $logRecord = new LogRecord('foo', LogLevel::INFO, 'A message with a {placeholder}', ['placeholder' => 'bar']);
In that case the {placeholder} of the message will be substituted by "bar" when processed by the PsrLogProcessor shipped with the extension.
In order to activate the Processor you can configure it i.e. via ext_localconf.php
$GLOBALS['TYPO3_CONF_VARS']['LOG']['Documentation']['Examples']['Controller']['processorConfiguration'] = [ // configuration for Debug level log entries and above \TYPO3\CMS\Core\Log\LogLevel::DEBUG => [ \Ssch\Psr3LogProcessor\Processor\PsrLogMessageProcessor::class => [ // The format of the timestamp: one supported by DateTime::format 'dateFormat' => DateTime::ISO8601, // If set to true the fields interpolated into message gets unset 'removeUsedContextFields' => true, // Arrays will be json encoded. With this option you can define how this will happen 'jsonFlags' => JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ] ] ];
Credits
This LogProcessor is heavily inspired by the Processor of monolog/monolog