diff options
author | Bart Visscher <bartv@thisnet.nl> | 2013-06-27 20:10:45 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2013-06-27 20:10:54 +0200 |
commit | 2eaad589221a9a189cece52390873f9bd27f113b (patch) | |
tree | 11649909023ee58bc9195f85b716a602f7cd1202 /lib/legacy | |
parent | 009e9559f3a12d7275ab242ececaa7f9452165c1 (diff) | |
download | nextcloud-server-2eaad589221a9a189cece52390873f9bd27f113b.tar.gz nextcloud-server-2eaad589221a9a189cece52390873f9bd27f113b.zip |
Make the object drive the logging backend
This is the other way around then it was.
Diffstat (limited to 'lib/legacy')
-rw-r--r-- | lib/legacy/log.php | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/legacy/log.php b/lib/legacy/log.php index 4e6642b6a2f..a316051d5af 100644 --- a/lib/legacy/log.php +++ b/lib/legacy/log.php @@ -23,6 +23,14 @@ class OC_Log { const ERROR=3; const FATAL=4; + static private $level_funcs = array( + self::DEBUG => 'debug', + self::INFO => 'info', + self::WARN => 'warning', + self::ERROR => 'error', + self::FATAL => 'emergency', + ); + static public $enabled = true; static protected $class = null; @@ -34,12 +42,9 @@ class OC_Log { */ public static function write($app, $message, $level) { 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); + $context = array('app' => $app); + $func = array(self::$object, self::$level_funcs[$level]); + call_user_func($func, $message, $context); } } |