From cd13cc0511736283fb27de647a22dfce0d3bff11 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 2 Jun 2010 11:24:20 +0000 Subject: [PATCH] Updated logging -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 | 6 +++--- gosa-core/include/class_log.inc | 19 ++++++++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/gosa-core/include/class_configRegistry.inc b/gosa-core/include/class_configRegistry.inc index 47355e574..7b864e5b8 100644 --- a/gosa-core/include/class_configRegistry.inc +++ b/gosa-core/include/class_configRegistry.inc @@ -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(),''); } diff --git a/gosa-core/include/class_log.inc b/gosa-core/include/class_log.inc index 342135cab..b03687de7 100644 --- a/gosa-core/include/class_log.inc +++ b/gosa-core/include/class_log.inc @@ -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); } -- 2.30.2