diff options
author | mwithheld <796986+mwithheld@users.noreply.github.com> | 2021-07-11 23:17:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-11 23:17:52 +0300 |
commit | 288c07e4fc6487c88e41c054876f60badc1cde2c (patch) | |
tree | c807941bb26e23a8344482e51d8f483284a49763 /plugins/Monolog | |
parent | de01ea3ead5003a351ac09bbc2ecf99f8047c012 (diff) |
Add log handlers syslog and errorlog (#17745)
Issue#9400
Diffstat (limited to 'plugins/Monolog')
-rw-r--r-- | plugins/Monolog/config/config.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/plugins/Monolog/config/config.php b/plugins/Monolog/config/config.php index 315c481366..887fa12aaa 100644 --- a/plugins/Monolog/config/config.php +++ b/plugins/Monolog/config/config.php @@ -17,6 +17,8 @@ return array( 'file' => 'Piwik\Plugins\Monolog\Handler\FileHandler', 'screen' => 'Piwik\Plugins\Monolog\Handler\WebNotificationHandler', 'database' => 'Piwik\Plugins\Monolog\Handler\DatabaseHandler', + 'syslog' => 'Piwik\Plugins\Monolog\Handler\SyslogHandler', + 'errorlog' => 'Piwik\Plugins\Monolog\Handler\ErrorLogHandler', ), 'log.handlers' => DI\factory(function (\DI\Container $c) { if ($c->has('ini.log.log_writers')) { @@ -98,6 +100,14 @@ return array( ->constructor(DI\get('log.file.filename'), DI\get('log.level.file')) ->method('setFormatter', DI\get('log.lineMessageFormatter.file')), + 'Piwik\Plugins\Monolog\Handler\SyslogHandler' => DI\create() + ->constructor('matomo', null, DI\get('log.level.syslog')) + ->method('setFormatter', DI\get('log.lineMessageFormatter.file')), + + 'Piwik\Plugins\Monolog\Handler\ErrorLogHandler' => DI\create() + ->constructor(null, DI\get('log.level.errorlog')) + ->method('setFormatter', DI\get('log.lineMessageFormatter.file')), + 'Piwik\Plugins\Monolog\Handler\DatabaseHandler' => DI\create() ->constructor(DI\get('log.level.database')) ->method('setFormatter', DI\get('log.lineMessageFormatter')), @@ -147,6 +157,26 @@ return array( return $c->get('log.level'); }), + 'log.level.syslog' => DI\factory(function (ContainerInterface $c) { + if ($c->has('ini.log.log_level_syslog')) { + $level = Log::getMonologLevelIfValid($c->get('ini.log.log_level_syslog')); + if ($level !== null) { + return $level; + } + } + return $c->get('log.level'); + }), + + 'log.level.errorlog' => DI\factory(function (ContainerInterface $c) { + if ($c->has('ini.log.log_level_errorlog')) { + $level = Log::getMonologLevelIfValid($c->get('ini.log.log_level_errorlog')); + if ($level !== null) { + return $level; + } + } + return $c->get('log.level'); + }), + 'log.file.filename' => DI\factory(function (ContainerInterface $c) { $logPath = $c->get('ini.log.logger_file_path'); |