logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ihabu...@apache.org
Subject svn commit: r1230527 - /logging/log4php/trunk/src/main/php/appenders/LoggerAppenderSyslog.php
Date Thu, 12 Jan 2012 13:37:23 GMT
Author: ihabunek
Date: Thu Jan 12 13:37:23 2012
New Revision: 1230527

URL: http://svn.apache.org/viewvc?rev=1230527&view=rev
Log:
Replaced internal conversion of log level to syslog level in LoggerAppenderSyslog, instead
using equivalent syslog level defined in LoggerLevel.

Modified:
    logging/log4php/trunk/src/main/php/appenders/LoggerAppenderSyslog.php

Modified: logging/log4php/trunk/src/main/php/appenders/LoggerAppenderSyslog.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/appenders/LoggerAppenderSyslog.php?rev=1230527&r1=1230526&r2=1230527&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/appenders/LoggerAppenderSyslog.php (original)
+++ logging/log4php/trunk/src/main/php/appenders/LoggerAppenderSyslog.php Thu Jan 12 13:37:23
2012
@@ -128,16 +128,6 @@ class LoggerAppenderSyslog extends Logge
 	 * @var int
 	 */
 	private $intOption;
-	
-	/** Maps log4php levels to equivalent syslog priorities. */
-	private $levelMap = array(
-		LoggerLevel::TRACE => LOG_DEBUG,
-		LoggerLevel::DEBUG => LOG_DEBUG,
-		LoggerLevel::INFO  => LOG_INFO,
-		LoggerLevel::WARN  => LOG_WARNING,
-		LoggerLevel::ERROR => LOG_ERR,
-		LoggerLevel::FATAL => LOG_ALERT,
-	);
 
 	/**
 	 * Sets the {@link $ident}.
@@ -268,14 +258,7 @@ class LoggerAppenderSyslog extends Logge
 		if($this->overridePriority) {
 			return $this->intPriority;
 		}
-		
-		$int = $level->toInt();
-		
-		if (isset($this->levelMap[$int])) {
-			return $this->levelMap[$int];
-		} else {
-			return LOG_DEBUG;
-		}
+		return $level->getSyslogEquivalent();
 	}
 	
 	/** Parses a syslog option string and returns the correspodning int value. */



Mime
View raw message