Code

Added pChart classes and GOsa mapping class to enable auto-include
[gosa.git] / gosa-core / include / class_log.inc
index ebaeff5a611b0eaf079a05c1f0ed3c178a1336aa..b03687de7ef086ec8acea8499efafc0957311f5b 100644 (file)
@@ -87,7 +87,7 @@ class log {
         msg_dialog::display(_("Internal error"), sprintf(_("Logging failed: %s"), $msg), ERROR_DIALOG);
       }
     }else{
-      if(is_object($config) && preg_match("/true/i",$config->get_cfg_value("logging",""))){
+      if(is_object($config) && $config->boolValueIsTrue("core","logging")){
         $this->log_into_syslog($entry);
       }
     }
@@ -99,11 +99,11 @@ class log {
     $msgs = array();
 
     if(!isset($entry['action']) || !in_array($entry['action'],array("modify","create","remove","copy","snapshot","view","security","debug"))){
-      $msgs[] = sprintf(_("Invalid option '%s' specified!"), $entry['action']);
+      $msgs[] = sprintf(_("Invalid option %s specified!"), bold($entry['action']));
     }
 
-    if(!isset($entry['objecttype']) || empty($entry['objecttype'])){
-      $msgs[] = _("Specified objectType is empty or invalid!");
+    if(!isset($entry['objecttype'])){
+      $msgs[] = _("Specified 'objectType' is empty or invalid!");
     }
   
     return($msgs);
@@ -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);
   }