You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-dev@logging.apache.org by gr...@apache.org on 2009/05/05 06:14:49 UTC

svn commit: r771549 - /incubator/log4php/trunk/src/main/php/LoggerAppender.php

Author: grobmeier
Date: Tue May  5 04:14:48 2009
New Revision: 771549

URL: http://svn.apache.org/viewvc?rev=771549&view=rev
Log:
#LOG4PHP-40: Merged LoggerAppender with LoggerAppenderSkeleton - clean up

Modified:
    incubator/log4php/trunk/src/main/php/LoggerAppender.php

Modified: incubator/log4php/trunk/src/main/php/LoggerAppender.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/LoggerAppender.php?rev=771549&r1=771548&r2=771549&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/LoggerAppender.php (original)
+++ incubator/log4php/trunk/src/main/php/LoggerAppender.php Tue May  5 04:14:48 2009
@@ -80,21 +80,6 @@
 		$this->clearFilters();
 	}
 
-    /**
-	 * Add a filter to the end of the filter list.
-	 *
-	 * @param LoggerFilter $newFilter add a new LoggerFilter
-	 */
-	public function addFilter($newFilter) {
-		if($this->headFilter === null) {
-			$this->headFilter = $newFilter;
-			$this->tailFilter = $this->headFilter;
-		} else {
-			$this->tailFilter->next = $newFilter;
-			$this->tailFilter = $this->tailFilter->next;
-		}
-	}
-
 	/**
 	 * Factory
 	 *
@@ -136,22 +121,20 @@
 		return null;		
 	}
 
-	
-		/**
-	 * Derived appenders should override this method if option structure
-	 * requires it.
-	 */
-	abstract public function activateOptions();	   
-	
 	/**
-	 * Subclasses of {@link LoggerAppender} should implement 
-	 * this method to perform actual logging.
+	 * Add a filter to the end of the filter list.
 	 *
-	 * @param LoggerLoggingEvent $event
-	 * @see doAppend()
-	 * @abstract
+	 * @param LoggerFilter $newFilter add a new LoggerFilter
 	 */
-	abstract protected function append($event); 
+	public function addFilter($newFilter) {
+		if($this->headFilter === null) {
+			$this->headFilter = $newFilter;
+			$this->tailFilter = $this->headFilter;
+		} else {
+			$this->tailFilter->next = $newFilter;
+			$this->tailFilter = $this->tailFilter->next;
+		}
+	}
 	
 	/**
 	 * Clear the list of filters by removing all the filters in it.
@@ -165,18 +148,6 @@
 	}
 
 	/**
-	 * Finalize this appender by calling the derived class' <i>close()</i> method.
-	 */
-	public function finalize()  {
-		// An appender might be closed then garbage collected. There is no
-		// point in closing twice.
-		if($this->closed) {
-			return;
-		}
-		$this->close();
-	}
-			   
-	/**
 	 * Return the first filter in the filter chain for this Appender. 
 	 * The return value may be <i>null</i> if no is filter is set.
 	 * @return LoggerFilter
@@ -196,15 +167,7 @@
 	
 	
 	/**
-	 * Release any resources allocated.
-	 * Subclasses of {@link LoggerAppender} should implement 
-	 * this method to perform proper closing procedures.
-	 * @abstract
-	 */
-	abstract public function close();
-
-	/**
-	 * 	 * This method performs threshold checks and invokes filters before
+	 * This method performs threshold checks and invokes filters before
 	 * delegating actual logging to the subclasses specific <i>append()</i> method.
 	 * @see LoggerAppender::doAppend()
 	 * @param LoggerLoggingEvent $event
@@ -230,15 +193,6 @@
 	}	 
 
 	/**
-	 * Get the name of this appender.
-	 * @see LoggerAppender::getName()
-	 * @return string
-	 */
-	public function getName() {
-		return $this->name;
-	}
-	
-	/**
 	 * Do not use this method.
 	 * @see LoggerAppender::setErrorHandler()
 	 * @param object $errorHandler
@@ -282,18 +236,6 @@
 		return $this->layout;
 	}
 	
-/**
-	 * Set the name of this appender.
-	 *
-	 * The name is used by other components to identify this appender.
-	 *
-	 * 
-	 * @param string $name
-	 */
-	public function setName($name) {
-		$this->name = $name;	
-	}
-
 	/**
 	 * Configurators call this method to determine if the appender
 	 * requires a layout. 
@@ -317,6 +259,27 @@
 	}
 	
 	/**
+	 * Get the name of this appender.
+	 * @see LoggerAppender::getName()
+	 * @return string
+	 */
+	public function getName() {
+		return $this->name;
+	}
+	
+/**
+	 * Set the name of this appender.
+	 *
+	 * The name is used by other components to identify this appender.
+	 *
+	 * 
+	 * @param string $name
+	 */
+	public function setName($name) {
+		$this->name = $name;	
+	}
+	
+	/**
 	 * Returns this appenders threshold level. 
 	 * See the {@link setThreshold()} method for the meaning of this option.
 	 * @return LoggerLevel
@@ -325,7 +288,6 @@
 		return $this->threshold;
 	}
 	
-	
 	/**
 	 * Set the threshold level of this appender.
 	 *
@@ -354,8 +316,44 @@
 		}
 		return $priority->isGreaterOrEqual($this->getThreshold());
 	}
+
+	/**
+	 * Derived appenders should override this method if option structure
+	 * requires it.
+	 */
+	abstract public function activateOptions();	   
 	
 	/**
+	 * Subclasses of {@link LoggerAppender} should implement 
+	 * this method to perform actual logging.
+	 *
+	 * @param LoggerLoggingEvent $event
+	 * @see doAppend()
+	 * @abstract
+	 */
+	abstract protected function append($event); 
+
+	/**
+	 * Release any resources allocated.
+	 * Subclasses of {@link LoggerAppender} should implement 
+	 * this method to perform proper closing procedures.
+	 * @abstract
+	 */
+	abstract public function close();
+
+	/**
+	 * Finalize this appender by calling the derived class' <i>close()</i> method.
+	 */
+	public function finalize()  {
+		// An appender might be closed then garbage collected. There is no
+		// point in closing twice.
+		if($this->closed) {
+			return;
+		}
+		$this->close();
+	}
+		
+	/**
 	 * Perform actions before object serialization.
 	 *
 	 * Call {@link finalize()} to properly close the appender.