diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2015-08-19 15:15:11 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2015-08-19 15:15:11 +0300 |
commit | baec74598a8a57af403c35af40e7ea46570307d6 (patch) | |
tree | f4a675d82c594cfe2bdd04211703828186bc651b /plugins/Monolog | |
parent | 496bbbd15239c6cfa160679b2aa51cefa55b6fdb (diff) |
fix a system test
Diffstat (limited to 'plugins/Monolog')
-rw-r--r-- | plugins/Monolog/.gitignore | 1 | ||||
-rw-r--r-- | plugins/Monolog/config/tracker.php | 17 | ||||
-rw-r--r-- | plugins/Monolog/tests/System/TrackerLoggingTest.php | 7 |
3 files changed, 14 insertions, 11 deletions
diff --git a/plugins/Monolog/.gitignore b/plugins/Monolog/.gitignore new file mode 100644 index 0000000000..c8c9480010 --- /dev/null +++ b/plugins/Monolog/.gitignore @@ -0,0 +1 @@ +tests/System/processed/*xml
\ No newline at end of file diff --git a/plugins/Monolog/config/tracker.php b/plugins/Monolog/config/tracker.php index 22e06bb1f1..c9d0044b35 100644 --- a/plugins/Monolog/config/tracker.php +++ b/plugins/Monolog/config/tracker.php @@ -2,11 +2,16 @@ use Interop\Container\ContainerInterface; +function isTrackerDebugEnabled(ContainerInterface $c) +{ + $trackerDebug = $c->get("ini.Tracker.debug"); + return ($trackerDebug == 1 || !empty($GLOBALS['PIWIK_TRACKER_DEBUG'])); +} + return array( 'Psr\Log\LoggerInterface' => function (ContainerInterface $c) { - $trackerDebug = $c->get("ini.Tracker.debug"); - if ($trackerDebug == 1 || !empty($GLOBALS['PIWIK_TRACKER_DEBUG'])) { + if (isTrackerDebugEnabled($c)) { return $c->get('Monolog\Logger'); } else { return new \Psr\Log\NullLogger(); @@ -21,8 +26,12 @@ return array( return $previous; }), - 'log.level' => DI\factory(function (ContainerInterface $c) { - return \Monolog\Logger::DEBUG; + 'log.level' => DI\decorate(function ($previous, ContainerInterface $c) { + if (isTrackerDebugEnabled($c)) { + return \Monolog\Logger::DEBUG; + } + + return $previous; }) ); diff --git a/plugins/Monolog/tests/System/TrackerLoggingTest.php b/plugins/Monolog/tests/System/TrackerLoggingTest.php index efbd7b838f..70c933d13f 100644 --- a/plugins/Monolog/tests/System/TrackerLoggingTest.php +++ b/plugins/Monolog/tests/System/TrackerLoggingTest.php @@ -27,13 +27,6 @@ class TrackerLoggingTest extends SystemTestCase { parent::setUp(); - $testingEnvironment = self::$fixture->getTestEnvironment(); - $configOverride = $testingEnvironment->configOverride; - $configOverride['Tracker']['debug'] = 1; - $configOverride['log']['log_writers'] = array('screen'); - $testingEnvironment->configOverride = $configOverride; - $testingEnvironment->save(); - if (!Fixture::siteCreated($this->idSite)) { Fixture::createWebsite('2014-01-01 00:00:00'); } |