Code

Updated logging
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 2 Jun 2010 11:24:20 +0000 (11:24 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 2 Jun 2010 11:24:20 +0000 (11:24 +0000)
-Allow simple log messages without objectType/object and attributes.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18833 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_configRegistry.inc
gosa-core/include/class_log.inc

index 47355e5747c17b980a253698bb6a1e878732ccae..7b864e5b881aa4f72c06c0b48815ef8dbb79f43d 100644 (file)
@@ -142,7 +142,7 @@ class configRegistry{
                 if(isset($this->activePlugins[strtolower($cname)])){
                     $this->pluginRequirements[$cname] = $defs['plRequirements'];
                 }else{
-                    new log("debug","schemaValidation","Skipped schema check for '{$cname}' plugin is inactive!",
+                    new log("debug","","Skipped schema check for '{$cname}' plugin is inactive!",
                         array(),'');
                 }
             }
@@ -161,7 +161,7 @@ class configRegistry{
                         $this->schemaCheckFailed = TRUE;
                         $failure = TRUE;
 
-                        new log("debug","schemaValidation","LDAP objectClass missing '{$oc}'!",
+                        new log("debug","","LDAP objectClass missing '{$oc}'!",
                                 array(),'');
 
                     }elseif(!empty($version)){
@@ -175,7 +175,7 @@ class configRegistry{
                             $this->schemaCheckFailed = TRUE;
                             $failure = TRUE;
 
-                            new log("debug","schemaValidation","LDAP objectClass version mismatch '{$oc}' ".
+                            new log("debug","","LDAP objectClass version mismatch '{$oc}' ".
                                     "has '{$currentVersion}' but {$version} required!",
                                     array(),'');
                         }
index 342135cabd9bed4c67e97b231323b1d2b60d5c05..b03687de7ef086ec8acea8499efafc0957311f5b 100644 (file)
@@ -102,7 +102,7 @@ class log {
       $msgs[] = sprintf(_("Invalid option %s specified!"), bold($entry['action']));
     }
 
-    if(!isset($entry['objecttype']) || empty($entry['objecttype'])){
+    if(!isset($entry['objecttype'])){
       $msgs[] = _("Specified 'objectType' is empty or invalid!");
     }
   
@@ -114,11 +114,20 @@ class log {
   function log_into_syslog($entry)
   {
     $str= "";
-    if (empty($entry['object']) && empty($entry['changes'])) {
-      $str = "(".$entry['action'].") ".$entry['objecttype'].": ".$entry['result'];
-    } else {
-      $str = "(".$entry['action'].") ".$entry['object']." of type ".$entry['objecttype']." ".$entry['changes'].": ".$entry['result'];
+
+    if(!empty($entry['action']))        $str .= "({$entry['action']}) ";
+
+    // Add object and object type if set.
+    if(!empty($entry['object']) && !empty($entry['objecttype'])){
+        $str .= "{$entry['object']} of type {$entry['objecttype']} ";
+    }elseif(!empty($entry['object'])){
+        $str .= "{$entry['object']} ";
+    }elseif(!empty($entry['objecttype'])){
+        $str .= "{$entry['objecttype']} ";
     }
+    if(!empty($entry['changes'])) $str .= "{$entry['changes']} ";
+    if(!empty($entry['result']))  $str .= ": {$entry['result']} ";
+
     gosa_log($str);
   }