Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormwithheld <796986+mwithheld@users.noreply.github.com>2021-07-18 23:36:10 +0300
committerGitHub <noreply@github.com>2021-07-18 23:36:10 +0300
commitaf97af61ef7cdd880269bc2d4660ab01215fb440 (patch)
tree3569759c625252bca680d2cb827f6005517eda15 /plugins/Monolog
parent46b2655f4f0e4649bd3fdddc65b56c4967ea13fe (diff)
Add log handlers syslog and errorlog (#17764)
* Add log handlers syslog and errorlog Issue#9400 * Add log handlers syslog and errorlog * syslog/errorlog: fix namespace; add log.syslog.ident * syslog/errorlog: Document options * ErrorLogHandler constructor: Avoid null Avoid null in ErrorLogHandler constructor call: Use level param; default others * missing comma * fix two di definitions Co-authored-by: diosmosis <diosmosis@users.noreply.github.com>
Diffstat (limited to 'plugins/Monolog')
-rw-r--r--plugins/Monolog/config/config.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/plugins/Monolog/config/config.php b/plugins/Monolog/config/config.php
index 315c481366..7c73b4f044 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',
+ 'errorlog' => '\Monolog\Handler\ErrorLogHandler',
+ 'syslog' => '\Monolog\Handler\SyslogHandler',
),
'log.handlers' => DI\factory(function (\DI\Container $c) {
if ($c->has('ini.log.log_writers')) {
@@ -97,6 +99,14 @@ return array(
'Piwik\Plugins\Monolog\Handler\FileHandler' => DI\create()
->constructor(DI\get('log.file.filename'), DI\get('log.level.file'))
->method('setFormatter', DI\get('log.lineMessageFormatter.file')),
+
+ '\Monolog\Handler\ErrorLogHandler' => DI\autowire()
+ ->constructorParameter('level', DI\get('log.level.errorlog'))
+ ->method('setFormatter', DI\get('log.lineMessageFormatter.file')),
+
+ '\Monolog\Handler\SyslogHandler' => DI\create()
+ ->constructor(DI\get('log.syslog.ident'), 'syslog', DI\get('log.level.syslog'))
+ ->method('setFormatter', DI\get('log.lineMessageFormatter.file')),
'Piwik\Plugins\Monolog\Handler\DatabaseHandler' => DI\create()
->constructor(DI\get('log.level.database'))
@@ -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');
@@ -172,6 +202,14 @@ return array(
return $logPath;
}),
+
+ 'log.syslog.ident' => DI\factory(function (ContainerInterface $c) {
+ $ident = $c->get('ini.log.logger_syslog_ident');
+ if (empty($ident)) {
+ $ident = 'matomo';
+ }
+ return $ident;
+ }),
'Piwik\Plugins\Monolog\Formatter\LineMessageFormatter' => DI\create('Piwik\Plugins\Monolog\Formatter\LineMessageFormatter')
->constructor(DI\get('log.short.format')),