Code

Added debugging to rpc class.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 4 Jun 2010 12:37:55 +0000 (12:37 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 4 Jun 2010 12:37:55 +0000 (12:37 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18847 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_jsonRPC.inc

index 247f05411bd07fd1255bec9b35d1c61ab17516ba..54cb8b72db43bdd8d9bce88eb917493d4b7f3896 100644 (file)
@@ -21,6 +21,10 @@ class jsonRPC {
         $user   =  $this->config->get_cfg_value('core','gosaRpcUser');
         $passwd =  $this->config->get_cfg_value('core','gosaRpcPassword');
 
+        DEBUG (DEBUG_RPC, __LINE__, __FUNCTION__, __FILE__,bold($url), "Initiated RPC "); 
+        DEBUG (DEBUG_RPC, __LINE__, __FUNCTION__, __FILE__,bold($user), "RPC user: "); 
+        DEBUG (DEBUG_RPC, __LINE__, __FUNCTION__, __FILE__,bold($passwd),"RPC password: "); 
+
         // Init Curl handler
         $this->curlHandler = curl_init($url);
 
@@ -35,7 +39,6 @@ class jsonRPC {
         // Try to login 
         $this->login($user, $passwd);
        
-        DEBUG (DEBUG_RPC, __LINE__, __FUNCTION__, __FILE__,"RPC Login ".$this->get_error() , "Login"); 
     }
         
 
@@ -72,7 +75,15 @@ class jsonRPC {
              $this->__login();
         }
 
+        // Start request
+        DEBUG (DEBUG_RPC, __LINE__, __FUNCTION__, __FILE__,"{$method}", "Calling: "); 
         $response = $this->request($method,$params);
+        if($this->success()){
+            DEBUG (DEBUG_RPC, __LINE__, __FUNCTION__, __FILE__,bold($response['result']), "Result: "); 
+        }else{
+            DEBUG (DEBUG_RPC, __LINE__, __FUNCTION__, __FILE__,bold($this->get_error())."<br>".$response, "Result (FAILED): "); 
+        }
+
         return($response['result']);
     }