|
17 | 17 | 'file' => 'Piwik\Plugins\Monolog\Handler\FileHandler',
|
18 | 18 | 'screen' => 'Piwik\Plugins\Monolog\Handler\WebNotificationHandler',
|
19 | 19 | 'database' => 'Piwik\Plugins\Monolog\Handler\DatabaseHandler',
|
| 20 | + 'errorlog' => '\Monolog\Handler\ErrorLogHandler', |
| 21 | + 'syslog' => '\Monolog\Handler\SyslogHandler', |
20 | 22 | ),
|
21 | 23 | 'log.handlers' => DI\factory(function (\DI\Container $c) {
|
22 | 24 | if ($c->has('ini.log.log_writers')) {
|
|
97 | 99 | 'Piwik\Plugins\Monolog\Handler\FileHandler' => DI\create()
|
98 | 100 | ->constructor(DI\get('log.file.filename'), DI\get('log.level.file'))
|
99 | 101 | ->method('setFormatter', DI\get('log.lineMessageFormatter.file')),
|
| 102 | + |
| 103 | + '\Monolog\Handler\ErrorLogHandler' => DI\autowire() |
| 104 | + ->constructorParameter('level', DI\get('log.level.errorlog')) |
| 105 | + ->method('setFormatter', DI\get('log.lineMessageFormatter.file')), |
| 106 | + |
| 107 | + '\Monolog\Handler\SyslogHandler' => DI\create() |
| 108 | + ->constructor(DI\get('log.syslog.ident'), 'syslog', DI\get('log.level.syslog')) |
| 109 | + ->method('setFormatter', DI\get('log.lineMessageFormatter.file')), |
100 | 110 |
|
101 | 111 | 'Piwik\Plugins\Monolog\Handler\DatabaseHandler' => DI\create()
|
102 | 112 | ->constructor(DI\get('log.level.database'))
|
|
147 | 157 | return $c->get('log.level');
|
148 | 158 | }),
|
149 | 159 |
|
| 160 | + 'log.level.syslog' => DI\factory(function (ContainerInterface $c) { |
| 161 | + if ($c->has('ini.log.log_level_syslog')) { |
| 162 | + $level = Log::getMonologLevelIfValid($c->get('ini.log.log_level_syslog')); |
| 163 | + if ($level !== null) { |
| 164 | + return $level; |
| 165 | + } |
| 166 | + } |
| 167 | + return $c->get('log.level'); |
| 168 | + }), |
| 169 | + |
| 170 | + 'log.level.errorlog' => DI\factory(function (ContainerInterface $c) { |
| 171 | + if ($c->has('ini.log.log_level_errorlog')) { |
| 172 | + $level = Log::getMonologLevelIfValid($c->get('ini.log.log_level_errorlog')); |
| 173 | + if ($level !== null) { |
| 174 | + return $level; |
| 175 | + } |
| 176 | + } |
| 177 | + return $c->get('log.level'); |
| 178 | + }), |
| 179 | + |
150 | 180 | 'log.file.filename' => DI\factory(function (ContainerInterface $c) {
|
151 | 181 | $logPath = $c->get('ini.log.logger_file_path');
|
152 | 182 |
|
|
172 | 202 |
|
173 | 203 | return $logPath;
|
174 | 204 | }),
|
| 205 | + |
| 206 | + 'log.syslog.ident' => DI\factory(function (ContainerInterface $c) { |
| 207 | + $ident = $c->get('ini.log.logger_syslog_ident'); |
| 208 | + if (empty($ident)) { |
| 209 | + $ident = 'matomo'; |
| 210 | + } |
| 211 | + return $ident; |
| 212 | + }), |
175 | 213 |
|
176 | 214 | 'Piwik\Plugins\Monolog\Formatter\LineMessageFormatter' => DI\create('Piwik\Plugins\Monolog\Formatter\LineMessageFormatter')
|
177 | 215 | ->constructor(DI\get('log.short.format')),
|
|
0 commit comments