From d589869a345bea06874bb38bd54762c972d93249 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 12 Oct 2012 15:45:05 +0200 Subject: [PATCH] disable log when running tests --- lib/log.php | 13 ++++++++----- tests/bootstrap.php | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/log.php b/lib/log.php index 8bb2839be66..6de99b4ea6b 100644 --- a/lib/log.php +++ b/lib/log.php @@ -20,6 +20,7 @@ class OC_Log { const ERROR=3; const FATAL=4; + static public $enabled = true; static protected $class = null; /** @@ -29,11 +30,13 @@ class OC_Log { * @param int level */ public static function write($app, $message, $level) { - if (!self::$class) { - self::$class = 'OC_Log_'.ucfirst(OC_Config::getValue('log_type', 'owncloud')); - call_user_func(array(self::$class, 'init')); + if (self::$enabled) { + if (!self::$class) { + self::$class = 'OC_Log_'.ucfirst(OC_Config::getValue('log_type', 'owncloud')); + call_user_func(array(self::$class, 'init')); + } + $log_class=self::$class; + $log_class::write($app, $message, $level); } - $log_class=self::$class; - $log_class::write($app, $message, $level); } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 4bb980b5b76..f8364b71ef7 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -26,3 +26,4 @@ abstract class UnitTestCase extends PHPUnit_Framework_TestCase{ } OC_Hook::clear(); +OC_Log::$enabled = false; -- 2.39.5