diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2015-08-19 11:12:43 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2015-08-19 13:56:26 +0300 |
commit | 763d19b594ff4e1aec4785e0816f7d57114c3a82 (patch) | |
tree | 9e2a4251c827fabd5b818a50d1eb6bbe07cf2516 /plugins/Monolog/config | |
parent | de5f4f219a8eb2b6d23129bb2bf767581b5c3320 (diff) |
use monolog in tracker
Diffstat (limited to 'plugins/Monolog/config')
-rw-r--r-- | plugins/Monolog/config/config.php | 17 | ||||
-rw-r--r-- | plugins/Monolog/config/tracker.php | 16 |
2 files changed, 26 insertions, 7 deletions
diff --git a/plugins/Monolog/config/config.php b/plugins/Monolog/config/config.php index 22cf7debee..5a9b2baf5c 100644 --- a/plugins/Monolog/config/config.php +++ b/plugins/Monolog/config/config.php @@ -11,17 +11,24 @@ return array( 'Psr\Log\LoggerInterface' => DI\get('Monolog\Logger'), + 'log.handler.classes' => DI\factory(function (ContainerInterface $c) { + $classes = array( + 'file' => 'Piwik\Plugins\Monolog\Handler\FileHandler', + 'screen' => 'Piwik\Plugins\Monolog\Handler\WebNotificationHandler', + 'database' => 'Piwik\Plugins\Monolog\Handler\DatabaseHandler', + ); + + return $classes; + }), 'log.handlers' => DI\factory(function (ContainerInterface $c) { if ($c->has('ini.log.log_writers')) { $writerNames = $c->get('ini.log.log_writers'); } else { return array(); } - $classes = array( - 'file' => 'Piwik\Plugins\Monolog\Handler\FileHandler', - 'screen' => 'Piwik\Plugins\Monolog\Handler\WebNotificationHandler', - 'database' => 'Piwik\Plugins\Monolog\Handler\DatabaseHandler', - ); + + $classes = $c->get('log.handler.classes'); + $writerNames = array_map('trim', $writerNames); $writers = array(); foreach ($writerNames as $writerName) { diff --git a/plugins/Monolog/config/tracker.php b/plugins/Monolog/config/tracker.php index c1a19a6618..a1220a7682 100644 --- a/plugins/Monolog/config/tracker.php +++ b/plugins/Monolog/config/tracker.php @@ -6,11 +6,23 @@ return array( 'Psr\Log\LoggerInterface' => function (ContainerInterface $c) { $trackerDebug = $c->get("ini.Tracker.debug"); - if ($trackerDebug == 1) { + if ($trackerDebug == 1 || $GLOBALS['PIWIK_TRACKER_DEBUG']) { return $c->get('Monolog\Logger'); } else { return new \Psr\Log\NullLogger(); } - } + }, + + 'log.handler.classes' => DI\decorate(function ($previous) { + if (isset($previous['screen'])) { + $previous['screen'] = 'Piwik\Plugins\Monolog\Handler\EchoHandler'; + } + + return $previous; + }), + + 'log.level' => DI\factory(function (ContainerInterface $c) { + return \Monolog\Logger::DEBUG; + }) ); |