]> source.dussan.org Git - nextcloud-server.git/commitdiff
disable log when running tests
authorRobin Appelman <icewind@owncloud.com>
Fri, 12 Oct 2012 13:45:05 +0000 (15:45 +0200)
committerRobin Appelman <icewind@owncloud.com>
Fri, 12 Oct 2012 13:45:05 +0000 (15:45 +0200)
lib/log.php
tests/bootstrap.php

index 8bb2839be66a36686539348fbfb913bbd16c361e..6de99b4ea6bd07977e4f1b8e4de2a13eb1643cac 100644 (file)
@@ -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);
        }
 }
index 4bb980b5b76d664da5cac05505c950d41c80514c..f8364b71ef79697f46d51887f7e5a2214b7870f0 100644 (file)
@@ -26,3 +26,4 @@ abstract class UnitTestCase extends PHPUnit_Framework_TestCase{
 }
 
 OC_Hook::clear();
+OC_Log::$enabled = false;