From b3036967a2faeb4de7b3adc2ea0f9fa9de5f6382 Mon Sep 17 00:00:00 2001 From: Olov Danielson Date: Thu, 14 Jan 2010 11:41:43 +0000 Subject: [PATCH] Log module logs log_level as well --- ykval-log.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/ykval-log.php b/ykval-log.php index 53d29dd..c2266ab 100644 --- a/ykval-log.php +++ b/ykval-log.php @@ -7,6 +7,16 @@ class Log { $this->name=$name; $this->fields=array(); + + $this->LOG_LEVELS = array(LOG_EMERG=>'LOG_EMERG', + LOG_ALERT=>'LOG_ALERT', + LOG_CRIT=>'LOG_CRIT', + LOG_ERR=>'LOG_ERR', + LOG_WARNING=>'LOG_WARNING', + LOG_NOTICE=>'LOG_NOTICE', + LOG_INFO=>'LOG_INFO', + LOG_DEBUG=>'LOG_DEBUG'); + } function addField($name, $value) @@ -23,9 +33,13 @@ class Log # Add fields $msg_fields = ""; foreach ($this->fields as $field=>$value) { - $mes_fields .= "[" . $value . "] "; + $msg_fields .= "[" . $value . "] "; } - syslog($priority, $this->name . ':' . $msg_fields . $message); + syslog($priority, + $this->LOG_LEVELS[$priority] . ':' . + $this->name . ':' . + $msg_fields . + $message); } }