From b287c4ddbbd1652b562890181082369f9184c68c Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 4 Jun 2010 12:30:33 +0000 Subject: [PATCH] Updated debugLevel handling -With the new property handling it was ever 0, the used value for debugLevel was ignored. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18846 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_jsonRPC.inc | 6 ++--- gosa-core/include/functions.inc | 34 +++++++++++++++++------------ 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/gosa-core/include/class_jsonRPC.inc b/gosa-core/include/class_jsonRPC.inc index 91f1c2b0a..247f05411 100644 --- a/gosa-core/include/class_jsonRPC.inc +++ b/gosa-core/include/class_jsonRPC.inc @@ -2,16 +2,14 @@ class jsonRPC { private $curlHandler = NULL; - private $debug; private $config; private $id; private $lastStats = array(); private $lastAction = "none"; - public function __construct($config, $debug = false) + public function __construct($config) { $this->config = $config; - $this->debug = $debug; $this->id = 0; $this->__login(); } @@ -36,6 +34,8 @@ class jsonRPC { // Try to login $this->login($user, $passwd); + + DEBUG (DEBUG_RPC, __LINE__, __FUNCTION__, __FILE__,"RPC Login ".$this->get_error() , "Login"); } diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index 7bc65e526..829f7dce7 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -89,6 +89,7 @@ define ("DEBUG_ACL", 128); /*! Debug level for ACL infos */ define ("DEBUG_SI", 256); /*! Debug level for communication with gosa-si */ define ("DEBUG_MAIL", 512); /*! Debug level for all about mail (mailAccounts, imap, sieve etc.) */ define ("DEBUG_FAI", 1024); // FAI (incomplete) +define ("DEBUG_RPC", 2048); /*! Debug level for communication with remote procedures */ /* Rewrite german 'umlauts' and spanish 'accents' to get better results */ @@ -209,21 +210,26 @@ function make_seed() { * */ function DEBUG($level, $line, $function, $file, $data, $info="") { - if (session::global_get('debugLevel') & $level){ - $output= "DEBUG[$level] "; - if ($function != ""){ - $output.= "($file:$function():$line) - $info: "; - } else { - $output.= "($file:$line) - $info: "; - } - echo $output; - if (is_array($data)){ - print_a($data); - } else { - echo "'$data'"; + global $config; + $debugLevel = 0; + if($config instanceOf config){ + $debugLevel = $config->get_cfg_value('core', 'debugLevel'); + } + if ($debugLevel & $level){ + $output= "DEBUG[$level] "; + if ($function != ""){ + $output.= "($file:$function():$line) - $info: "; + } else { + $output.= "($file:$line) - $info: "; + } + echo $output; + if (is_array($data)){ + print_a($data); + } else { + echo "'$data'"; + } + echo "
"; } - echo "
"; - } } -- 2.30.2