logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ihabu...@apache.org
Subject svn commit: r1343601 - in /logging/log4php/trunk/src/main/php: ./ appenders/ configurators/ helpers/ renderers/
Date Tue, 29 May 2012 08:43:20 GMT
Author: ihabunek
Date: Tue May 29 08:43:19 2012
New Revision: 1343601

URL: http://svn.apache.org/viewvc?rev=1343601&view=rev
Log:
Improved coding standards:
* Removed closing tag (?>) from end of file - insures no spaces are output
* Replaced single-letter variable names with more understandable ones.
* Removed unused variables

Modified:
    logging/log4php/trunk/src/main/php/Logger.php
    logging/log4php/trunk/src/main/php/LoggerAppender.php
    logging/log4php/trunk/src/main/php/LoggerConfigurable.php
    logging/log4php/trunk/src/main/php/appenders/LoggerAppenderConsole.php
    logging/log4php/trunk/src/main/php/appenders/LoggerAppenderMailEvent.php
    logging/log4php/trunk/src/main/php/appenders/LoggerAppenderMongoDB.php
    logging/log4php/trunk/src/main/php/appenders/LoggerAppenderNull.php
    logging/log4php/trunk/src/main/php/appenders/LoggerAppenderPDO.php
    logging/log4php/trunk/src/main/php/configurators/LoggerConfigurationAdapter.php
    logging/log4php/trunk/src/main/php/configurators/LoggerConfigurationAdapterINI.php
    logging/log4php/trunk/src/main/php/configurators/LoggerConfigurationAdapterPHP.php
    logging/log4php/trunk/src/main/php/configurators/LoggerConfigurationAdapterXML.php
    logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorDefault.php
    logging/log4php/trunk/src/main/php/helpers/LoggerOptionConverter.php
    logging/log4php/trunk/src/main/php/renderers/LoggerRenderer.php
    logging/log4php/trunk/src/main/php/renderers/LoggerRendererDefault.php
    logging/log4php/trunk/src/main/php/renderers/LoggerRendererException.php
    logging/log4php/trunk/src/main/php/renderers/LoggerRendererMap.php
    logging/log4php/trunk/src/main/php/renderers/LoggerRendererObject.php

Modified: logging/log4php/trunk/src/main/php/Logger.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/Logger.php?rev=1343601&r1=1343600&r2=1343601&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/Logger.php (original)
+++ logging/log4php/trunk/src/main/php/Logger.php Tue May 29 08:43:19 2012
@@ -569,5 +569,4 @@ class Logger {
 	private static function isInitialized() {
 		return self::$initialized;
 	}
-	
 }

Modified: logging/log4php/trunk/src/main/php/LoggerAppender.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/LoggerAppender.php?rev=1343601&r1=1343600&r2=1343601&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/LoggerAppender.php (original)
+++ logging/log4php/trunk/src/main/php/LoggerAppender.php Tue May 29 08:43:19 2012
@@ -148,12 +148,12 @@ abstract class LoggerAppender extends Lo
 			return;
 		}
 
-		$f = $this->getFirstFilter();
-		while($f !== null) {
-			switch ($f->decide($event)) {
+		$filter = $this->getFirstFilter();
+		while($filter !== null) {
+			switch ($filter->decide($event)) {
 				case LoggerFilter::DENY: return;
 				case LoggerFilter::ACCEPT: return $this->append($event);
-				case LoggerFilter::NEUTRAL: $f = $f->getNext();
+				case LoggerFilter::NEUTRAL: $filter = $filter->getNext();
 			}
 		}
 		$this->append($event);

Modified: logging/log4php/trunk/src/main/php/LoggerConfigurable.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/LoggerConfigurable.php?rev=1343601&r1=1343600&r2=1343601&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/LoggerConfigurable.php (original)
+++ logging/log4php/trunk/src/main/php/LoggerConfigurable.php Tue May 29 08:43:19 2012
@@ -113,7 +113,3 @@ abstract class LoggerConfigurable {
 		trigger_error("log4php: $class: $message", E_USER_WARNING);
 	}
 }
-
-
-
-?>
\ No newline at end of file

Modified: logging/log4php/trunk/src/main/php/appenders/LoggerAppenderConsole.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/appenders/LoggerAppenderConsole.php?rev=1343601&r1=1343600&r2=1343601&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/appenders/LoggerAppenderConsole.php (original)
+++ logging/log4php/trunk/src/main/php/appenders/LoggerAppenderConsole.php Tue May 29 08:43:19
2012
@@ -82,10 +82,10 @@
 	 * @param string $target
 	 */
 	public function setTarget($target) {
-		$v = trim($target);
-		if ($v == self::STDOUT || strtoupper($v) == 'STDOUT') {
+		$value = trim($target);
+		if ($value == self::STDOUT || strtoupper($value) == 'STDOUT') {
 			$this->target = self::STDOUT;
-		} elseif ($v == self::STDERR || strtoupper($v) == 'STDERR') {
+		} elseif ($value == self::STDERR || strtoupper($value) == 'STDERR') {
 			$this->target = self::STDERR;
 		} else {
 			$target = var_export($target);

Modified: logging/log4php/trunk/src/main/php/appenders/LoggerAppenderMailEvent.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/appenders/LoggerAppenderMailEvent.php?rev=1343601&r1=1343600&r2=1343601&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/appenders/LoggerAppenderMailEvent.php (original)
+++ logging/log4php/trunk/src/main/php/appenders/LoggerAppenderMailEvent.php Tue May 29 08:43:19
2012
@@ -177,7 +177,4 @@ class LoggerAppenderMailEvent extends Lo
 	public function setDry($dry) {
 		$this->setBoolean('dry', $dry);
 	}
-
-	
-
 }

Modified: logging/log4php/trunk/src/main/php/appenders/LoggerAppenderMongoDB.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/appenders/LoggerAppenderMongoDB.php?rev=1343601&r1=1343600&r2=1343601&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/appenders/LoggerAppenderMongoDB.php (original)
+++ logging/log4php/trunk/src/main/php/appenders/LoggerAppenderMongoDB.php Tue May 29 08:43:19
2012
@@ -314,4 +314,3 @@ class LoggerAppenderMongoDB extends Logg
 		return $this->collection;
 	}
 }
-?>
\ No newline at end of file

Modified: logging/log4php/trunk/src/main/php/appenders/LoggerAppenderNull.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/appenders/LoggerAppenderNull.php?rev=1343601&r1=1343600&r2=1343601&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/appenders/LoggerAppenderNull.php (original)
+++ logging/log4php/trunk/src/main/php/appenders/LoggerAppenderNull.php Tue May 29 08:43:19
2012
@@ -42,4 +42,3 @@ class LoggerAppenderNull extends LoggerA
 	public function append(LoggerLoggingEvent $event) {
 	}
 }
-

Modified: logging/log4php/trunk/src/main/php/appenders/LoggerAppenderPDO.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/appenders/LoggerAppenderPDO.php?rev=1343601&r1=1343600&r2=1343601&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/appenders/LoggerAppenderPDO.php (original)
+++ logging/log4php/trunk/src/main/php/appenders/LoggerAppenderPDO.php Tue May 29 08:43:19
2012
@@ -283,4 +283,3 @@ class LoggerAppenderPDO extends LoggerAp
 		return $this->setString('dsn', $dsn);
 	}	
 }
-

Modified: logging/log4php/trunk/src/main/php/configurators/LoggerConfigurationAdapter.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/configurators/LoggerConfigurationAdapter.php?rev=1343601&r1=1343600&r2=1343601&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/configurators/LoggerConfigurationAdapter.php (original)
+++ logging/log4php/trunk/src/main/php/configurators/LoggerConfigurationAdapter.php Tue May
29 08:43:19 2012
@@ -37,4 +37,3 @@ interface LoggerConfigurationAdapter
 
 }
 
-?>
\ No newline at end of file

Modified: logging/log4php/trunk/src/main/php/configurators/LoggerConfigurationAdapterINI.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/configurators/LoggerConfigurationAdapterINI.php?rev=1343601&r1=1343600&r2=1343601&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/configurators/LoggerConfigurationAdapterINI.php (original)
+++ logging/log4php/trunk/src/main/php/configurators/LoggerConfigurationAdapterINI.php Tue
May 29 08:43:19 2012
@@ -297,4 +297,3 @@ class LoggerConfigurationAdapterINI impl
 	
 }
 
-?>
\ No newline at end of file

Modified: logging/log4php/trunk/src/main/php/configurators/LoggerConfigurationAdapterPHP.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/configurators/LoggerConfigurationAdapterPHP.php?rev=1343601&r1=1343600&r2=1343601&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/configurators/LoggerConfigurationAdapterPHP.php (original)
+++ logging/log4php/trunk/src/main/php/configurators/LoggerConfigurationAdapterPHP.php Tue
May 29 08:43:19 2012
@@ -82,4 +82,3 @@ class LoggerConfigurationAdapterPHP impl
 	}
 }
 
-?>
\ No newline at end of file

Modified: logging/log4php/trunk/src/main/php/configurators/LoggerConfigurationAdapterXML.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/configurators/LoggerConfigurationAdapterXML.php?rev=1343601&r1=1343600&r2=1343601&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/configurators/LoggerConfigurationAdapterXML.php (original)
+++ logging/log4php/trunk/src/main/php/configurators/LoggerConfigurationAdapterXML.php Tue
May 29 08:43:19 2012
@@ -255,4 +255,3 @@ class LoggerConfigurationAdapterXML impl
 	}
 }
 
-?>
\ No newline at end of file

Modified: logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorDefault.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorDefault.php?rev=1343601&r1=1343600&r2=1343601&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorDefault.php (original)
+++ logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorDefault.php Tue May
29 08:43:19 2012
@@ -435,7 +435,6 @@ class LoggerConfiguratorDefault implemen
 			if (isset($level)) {
 				$logger->setLevel($level);
 			} else {
-				$default = $logger->getLevel();
 				$this->warn("Invalid level value [{$config['level']}] specified for logger [$loggerName].
Ignoring level definition.");
 			}
 		}
@@ -501,4 +500,4 @@ class LoggerConfiguratorDefault implemen
 	private function warn($message) {
 		trigger_error("log4php: $message", E_USER_WARNING);
 	}
-}
\ No newline at end of file
+}

Modified: logging/log4php/trunk/src/main/php/helpers/LoggerOptionConverter.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/helpers/LoggerOptionConverter.php?rev=1343601&r1=1343600&r2=1343601&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/helpers/LoggerOptionConverter.php (original)
+++ logging/log4php/trunk/src/main/php/helpers/LoggerOptionConverter.php Tue May 29 08:43:19
2012
@@ -248,20 +248,20 @@ class LoggerOptionConverter {
 			return $default;
 		}
 
-		$s = strtoupper(trim($value));
+		$string = strtoupper(trim($value));
 		$multiplier = (float)1;
-		if(($index = strpos($s, 'KB')) !== false) {
+		if(($index = strpos($string, 'KB')) !== false) {
 			$multiplier = 1024;
-			$s = substr($s, 0, $index);
-		} else if(($index = strpos($s, 'MB')) !== false) {
+			$string = substr($string, 0, $index);
+		} else if(($index = strpos($string, 'MB')) !== false) {
 			$multiplier = 1024 * 1024;
-			$s = substr($s, 0, $index);
-		} else if(($index = strpos($s, 'GB')) !== false) {
+			$string = substr($string, 0, $index);
+		} else if(($index = strpos($string, 'GB')) !== false) {
 			$multiplier = 1024 * 1024 * 1024;
-			$s = substr($s, 0, $index);
+			$string = substr($string, 0, $index);
 		}
-		if(is_numeric($s)) {
-			return (float)$s * $multiplier;
+		if(is_numeric($string)) {
+			return (float)$string * $multiplier;
 		} 
 		return $default;
 	}

Modified: logging/log4php/trunk/src/main/php/renderers/LoggerRenderer.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/renderers/LoggerRenderer.php?rev=1343601&r1=1343600&r2=1343601&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/renderers/LoggerRenderer.php (original)
+++ logging/log4php/trunk/src/main/php/renderers/LoggerRenderer.php Tue May 29 08:43:19 2012
@@ -39,8 +39,8 @@
 interface LoggerRenderer {
 	/**
 	 * Render the entity passed as parameter as a String.
-	 * @param mixed $o entity to render
+	 * @param mixed $input entity to render
 	 * @return string
 	 */
-	public function render($o);
+	public function render($input);
 }

Modified: logging/log4php/trunk/src/main/php/renderers/LoggerRendererDefault.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/renderers/LoggerRendererDefault.php?rev=1343601&r1=1343600&r2=1343601&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/renderers/LoggerRendererDefault.php (original)
+++ logging/log4php/trunk/src/main/php/renderers/LoggerRendererDefault.php Tue May 29 08:43:19
2012
@@ -42,10 +42,10 @@ class LoggerRendererDefault implements L
 	/**
 	 * Render objects by type casting
 	 *
-	 * @param mixed $o the object to render
+	 * @param mixed $input the object to render
 	 * @return string
 	 */
-	public function render($o) {
-		return var_export($o, true);
+	public function render($input) {
+		return var_export($input, true);
 	}
 }

Modified: logging/log4php/trunk/src/main/php/renderers/LoggerRendererException.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/renderers/LoggerRendererException.php?rev=1343601&r1=1343600&r2=1343601&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/renderers/LoggerRendererException.php (original)
+++ logging/log4php/trunk/src/main/php/renderers/LoggerRendererException.php Tue May 29 08:43:19
2012
@@ -27,15 +27,14 @@
  */
 class LoggerRendererException implements LoggerRenderer {
 
-	public function render($o) {
-		$strRep  = 'Throwable('.get_class($o).'): '.$o->getMessage().' in '.$o->getFile().'
on line '.$o->getLine();
-		$strRep .= PHP_EOL.$o->getTraceAsString();
+	public function render($input) {
+		$strRep  = 'Throwable('.get_class($input).'): '.$input->getMessage().' in '.$input->getFile().'
on line '.$input->getLine();
+		$strRep .= PHP_EOL.$input->getTraceAsString();
 		
-		if (method_exists($o, 'getPrevious') && $o->getPrevious() !== null) {
-			$strRep .= PHP_EOL.'Caused by: '.$this->render($o->getPrevious());
+		if (method_exists($input, 'getPrevious') && $input->getPrevious() !== null)
{
+			$strRep .= PHP_EOL.'Caused by: '.$this->render($input->getPrevious());
 		}
 		
 		return $strRep;		
 	}
 }
-?>
\ No newline at end of file

Modified: logging/log4php/trunk/src/main/php/renderers/LoggerRendererMap.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/renderers/LoggerRendererMap.php?rev=1343601&r1=1343600&r2=1343601&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/renderers/LoggerRendererMap.php (original)
+++ logging/log4php/trunk/src/main/php/renderers/LoggerRendererMap.php Tue May 29 08:43:19
2012
@@ -47,7 +47,6 @@ class LoggerRendererMap {
 	private $defaultRenderer;
 	
 	/**
-	 * 
 	 * @var LoggerRendererObject
 	 */
 	private $defaultObjectRenderer;
@@ -88,23 +87,23 @@ class LoggerRendererMap {
 	 * Once a renderer is found, it is applied on the object <var>o</var> and 
 	 * the result is returned as a string.
 	 *
-	 * @param mixed $o
+	 * @param mixed $input
 	 * @return string 
 	 */
-	public function findAndRender($o) {
-		if($o == null) {
+	public function findAndRender($input) {
+		if($input == null) {
 			return null;
 		} else {
-			if(is_object($o)) {
-				$renderer = $this->getByObject($o);
+			if(is_object($input)) {
+				$renderer = $this->getByObject($input);
 				if($renderer !== null) {
-					return $renderer->render($o);
+					return $renderer->render($input);
 				}
 
-				return $this->defaultObjectRenderer->render($o);
+				return $this->defaultObjectRenderer->render($input);
 			} else {
 				$renderer = $this->defaultRenderer;
-				return $renderer->render($o);
+				return $renderer->render($input);
 			}
 		}
 	}
@@ -113,11 +112,11 @@ class LoggerRendererMap {
 	 * Syntactic sugar method that calls {@link PHP_MANUAL#get_class} with the
 	 * class of the object parameter.
 	 * 
-	 * @param mixed $o
+	 * @param mixed $object
 	 * @return string
 	 */
-	public function getByObject($o) {
-		return ($o == null) ? null : $this->getByClassName(get_class($o));
+	public function getByObject($object) {
+		return ($object == null) ? null : $this->getByClassName(get_class($object));
 	}
 
 
@@ -131,10 +130,10 @@ class LoggerRendererMap {
 	 * @return LoggerRendererObject
 	 */
 	public function getByClassName($class) {
-		for($c = $class; !empty($c); $c = get_parent_class($c)) {
-			$c = strtolower($c);
-			if(isset($this->map[$c])) {
-				return $this->map[$c];
+		for(; !empty($class); $class = get_parent_class($class)) {
+			$class = strtolower($class);
+			if(isset($this->map[$class])) {
+				return $this->map[$class];
 			}
 		}
 		return null;
@@ -145,12 +144,12 @@ class LoggerRendererMap {
 	}
 
 	/**
-	 * Register a {@link LoggerRendererObject} for <var>clazz</var>.
-	 * @param string $class
-	 * @param LoggerRendererObject $or
+	 * Register a {@link LoggerRendererObject}.
+	 * @param string $class Class which to render.
+	 * @param LoggerRendererObject $renderer
 	 */
-	private function put($class, $or) {
-		$this->map[strtolower($class)] = $or;
+	private function put($class, $renderer) {
+		$this->map[strtolower($class)] = $renderer;
 	}
 	
 	public function setDefaultObjectRenderer($renderer) {

Modified: logging/log4php/trunk/src/main/php/renderers/LoggerRendererObject.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/renderers/LoggerRendererObject.php?rev=1343601&r1=1343600&r2=1343601&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/renderers/LoggerRendererObject.php (original)
+++ logging/log4php/trunk/src/main/php/renderers/LoggerRendererObject.php Tue May 29 08:43:19
2012
@@ -33,5 +33,3 @@ class LoggerRendererObject implements Lo
 		return print_r($o, true);
 	}
 }
-
-?>
\ No newline at end of file



Mime
View raw message