logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ihabu...@apache.org
Subject [34/43] Fixed code formatting to conform to PSR-2
Date Thu, 28 Nov 2013 16:04:04 GMT
http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Level.php
----------------------------------------------------------------------
diff --git a/src/Level.php b/src/Level.php
index f17f0fc..78f8642 100644
--- a/src/Level.php
+++ b/src/Level.php
@@ -28,226 +28,250 @@ namespace Apache\Log4php;
  * level set.</p>
  * @since 0.5
  */
-class Level {
-
-	const OFF = 2147483647;
-	const FATAL = 50000;
-	const ERROR = 40000;
-	const WARN = 30000;
-	const INFO = 20000;
-	const DEBUG = 10000;
-	const TRACE = 5000;
-	const ALL = -2147483647;
-
-	/** Integer level value. */
-	private $level;
-
-	/** Contains a list of instantiated levels. */
-	private static $levelMap;
-
-	/** String representation of the level. */
-	private $levelStr;
-
-	/**
-	 * Equivalent syslog level.
-	 * @var integer
-	 */
-	private $syslogEquivalent;
-
-	/**
-	 * Constructor
-	 *
-	 * @param integer $level
-	 * @param string $levelStr
-	 * @param integer $syslogEquivalent
-	 */
-	private function __construct($level, $levelStr, $syslogEquivalent) {
-		$this->level = $level;
-		$this->levelStr = $levelStr;
-		$this->syslogEquivalent = $syslogEquivalent;
-	}
-
-	/**
-	 * Compares two logger levels.
-	 *
-	 * @param Level $other
-	 * @return boolean
-	 */
-	public function equals($other) {
-		if($other instanceof Level) {
-			if($this->level == $other->level) {
-				return true;
-			}
-		} else {
-			return false;
-		}
-	}
-
-	/**
-	 * Returns an Off Level
-	 * @return Level
-	 */
-	public static function getLevelOff() {
-		if(!isset(self::$levelMap[Level::OFF])) {
-			self::$levelMap[Level::OFF] = new Level(Level::OFF, 'OFF', LOG_ALERT);
-		}
-		return self::$levelMap[Level::OFF];
-	}
-
-	/**
-	 * Returns a Fatal Level
-	 * @return Level
-	 */
-	public static function getLevelFatal() {
-		if(!isset(self::$levelMap[Level::FATAL])) {
-			self::$levelMap[Level::FATAL] = new Level(Level::FATAL, 'FATAL', LOG_ALERT);
-		}
-		return self::$levelMap[Level::FATAL];
-	}
-
-	/**
-	 * Returns an Error Level
-	 * @return Level
-	 */
-	public static function getLevelError() {
-		if(!isset(self::$levelMap[Level::ERROR])) {
-			self::$levelMap[Level::ERROR] = new Level(Level::ERROR, 'ERROR', LOG_ERR);
-		}
-		return self::$levelMap[Level::ERROR];
-	}
-
-	/**
-	 * Returns a Warn Level
-	 * @return Level
-	 */
-	public static function getLevelWarn() {
-		if(!isset(self::$levelMap[Level::WARN])) {
-			self::$levelMap[Level::WARN] = new Level(Level::WARN, 'WARN', LOG_WARNING);
-		}
-		return self::$levelMap[Level::WARN];
-	}
-
-	/**
-	 * Returns an Info Level
-	 * @return Level
-	 */
-	public static function getLevelInfo() {
-		if(!isset(self::$levelMap[Level::INFO])) {
-			self::$levelMap[Level::INFO] = new Level(Level::INFO, 'INFO', LOG_INFO);
-		}
-		return self::$levelMap[Level::INFO];
-	}
-
-	/**
-	 * Returns a Debug Level
-	 * @return Level
-	 */
-	public static function getLevelDebug() {
-		if(!isset(self::$levelMap[Level::DEBUG])) {
-			self::$levelMap[Level::DEBUG] = new Level(Level::DEBUG, 'DEBUG', LOG_DEBUG);
-		}
-		return self::$levelMap[Level::DEBUG];
-	}
-
-	/**
-	 * Returns a Trace Level
-	 * @return Level
-	 */
-	public static function getLevelTrace() {
-		if(!isset(self::$levelMap[Level::TRACE])) {
-			self::$levelMap[Level::TRACE] = new Level(Level::TRACE, 'TRACE', LOG_DEBUG);
-		}
-		return self::$levelMap[Level::TRACE];
-	}
-
-	/**
-	 * Returns an All Level
-	 * @return Level
-	 */
-	public static function getLevelAll() {
-		if(!isset(self::$levelMap[Level::ALL])) {
-			self::$levelMap[Level::ALL] = new Level(Level::ALL, 'ALL', LOG_DEBUG);
-		}
-		return self::$levelMap[Level::ALL];
-	}
-
-	/**
-	 * Return the syslog equivalent of this level as an integer.
-	 * @return integer
-	 */
-	public function getSyslogEquivalent() {
-		return $this->syslogEquivalent;
-	}
-
-	/**
-	 * Returns <i>true</i> if this level has a higher or equal
-	 * level than the level passed as argument, <i>false</i>
-	 * otherwise.
-	 *
-	 * @param Level $other
-	 * @return boolean
-	 */
-	public function isGreaterOrEqual($other) {
-		return $this->level >= $other->level;
-	}
-
-	/**
-	 * Returns the string representation of this level.
-	 * @return string
-	 */
-	public function toString() {
-		return $this->levelStr;
-	}
-
-	/**
-	 * Returns the string representation of this level.
-	 * @return string
-	 */
-	public function __toString() {
-		return $this->toString();
-	}
-
-	/**
-	 * Returns the integer representation of this level.
-	 * @return integer
-	 */
-	public function toInt() {
-		return $this->level;
-	}
-
-	/**
-	 * Convert the input argument to a level. If the conversion fails, then
-	 * this method returns the provided default level.
-	 *
-	 * @param mixed $arg The value to convert to level.
-	 * @param Level $default Value to return if conversion is not possible.
-	 * @return Level
-	 */
-	public static function toLevel($arg, $defaultLevel = null) {
-		if(is_int($arg)) {
-			switch($arg) {
-				case self::ALL:	return self::getLevelAll();
-				case self::TRACE: return self::getLevelTrace();
-				case self::DEBUG: return self::getLevelDebug();
-				case self::INFO: return self::getLevelInfo();
-				case self::WARN: return self::getLevelWarn();
-				case self::ERROR: return self::getLevelError();
-				case self::FATAL: return self::getLevelFatal();
-				case self::OFF:	return self::getLevelOff();
-				default: return $defaultLevel;
-			}
-		} else {
-			switch(strtoupper($arg)) {
-				case 'ALL':	return self::getLevelAll();
-				case 'TRACE': return self::getLevelTrace();
-				case 'DEBUG': return self::getLevelDebug();
-				case 'INFO': return self::getLevelInfo();
-				case 'WARN': return self::getLevelWarn();
-				case 'ERROR': return self::getLevelError();
-				case 'FATAL': return self::getLevelFatal();
-				case 'OFF':	return self::getLevelOff();
-				default: return $defaultLevel;
-			}
-		}
-	}
+class Level
+{
+    const OFF = 2147483647;
+    const FATAL = 50000;
+    const ERROR = 40000;
+    const WARN = 30000;
+    const INFO = 20000;
+    const DEBUG = 10000;
+    const TRACE = 5000;
+    const ALL = -2147483647;
+
+    /** Integer level value. */
+    private $level;
+
+    /** Contains a list of instantiated levels. */
+    private static $levelMap;
+
+    /** String representation of the level. */
+    private $levelStr;
+
+    /**
+     * Equivalent syslog level.
+     * @var integer
+     */
+    private $syslogEquivalent;
+
+    /**
+     * Constructor
+     *
+     * @param integer $level
+     * @param string  $levelStr
+     * @param integer $syslogEquivalent
+     */
+    private function __construct($level, $levelStr, $syslogEquivalent)
+    {
+        $this->level = $level;
+        $this->levelStr = $levelStr;
+        $this->syslogEquivalent = $syslogEquivalent;
+    }
+
+    /**
+     * Compares two logger levels.
+     *
+     * @param  Level   $other
+     * @return boolean
+     */
+    public function equals($other)
+    {
+        if ($other instanceof Level) {
+            if ($this->level == $other->level) {
+                return true;
+            }
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Returns an Off Level
+     * @return Level
+     */
+    public static function getLevelOff()
+    {
+        if (!isset(self::$levelMap[Level::OFF])) {
+            self::$levelMap[Level::OFF] = new Level(Level::OFF, 'OFF', LOG_ALERT);
+        }
+
+        return self::$levelMap[Level::OFF];
+    }
+
+    /**
+     * Returns a Fatal Level
+     * @return Level
+     */
+    public static function getLevelFatal()
+    {
+        if (!isset(self::$levelMap[Level::FATAL])) {
+            self::$levelMap[Level::FATAL] = new Level(Level::FATAL, 'FATAL', LOG_ALERT);
+        }
+
+        return self::$levelMap[Level::FATAL];
+    }
+
+    /**
+     * Returns an Error Level
+     * @return Level
+     */
+    public static function getLevelError()
+    {
+        if (!isset(self::$levelMap[Level::ERROR])) {
+            self::$levelMap[Level::ERROR] = new Level(Level::ERROR, 'ERROR', LOG_ERR);
+        }
+
+        return self::$levelMap[Level::ERROR];
+    }
+
+    /**
+     * Returns a Warn Level
+     * @return Level
+     */
+    public static function getLevelWarn()
+    {
+        if (!isset(self::$levelMap[Level::WARN])) {
+            self::$levelMap[Level::WARN] = new Level(Level::WARN, 'WARN', LOG_WARNING);
+        }
+
+        return self::$levelMap[Level::WARN];
+    }
+
+    /**
+     * Returns an Info Level
+     * @return Level
+     */
+    public static function getLevelInfo()
+    {
+        if (!isset(self::$levelMap[Level::INFO])) {
+            self::$levelMap[Level::INFO] = new Level(Level::INFO, 'INFO', LOG_INFO);
+        }
+
+        return self::$levelMap[Level::INFO];
+    }
+
+    /**
+     * Returns a Debug Level
+     * @return Level
+     */
+    public static function getLevelDebug()
+    {
+        if (!isset(self::$levelMap[Level::DEBUG])) {
+            self::$levelMap[Level::DEBUG] = new Level(Level::DEBUG, 'DEBUG', LOG_DEBUG);
+        }
+
+        return self::$levelMap[Level::DEBUG];
+    }
+
+    /**
+     * Returns a Trace Level
+     * @return Level
+     */
+    public static function getLevelTrace()
+    {
+        if (!isset(self::$levelMap[Level::TRACE])) {
+            self::$levelMap[Level::TRACE] = new Level(Level::TRACE, 'TRACE', LOG_DEBUG);
+        }
+
+        return self::$levelMap[Level::TRACE];
+    }
+
+    /**
+     * Returns an All Level
+     * @return Level
+     */
+    public static function getLevelAll()
+    {
+        if (!isset(self::$levelMap[Level::ALL])) {
+            self::$levelMap[Level::ALL] = new Level(Level::ALL, 'ALL', LOG_DEBUG);
+        }
+
+        return self::$levelMap[Level::ALL];
+    }
+
+    /**
+     * Return the syslog equivalent of this level as an integer.
+     * @return integer
+     */
+    public function getSyslogEquivalent()
+    {
+        return $this->syslogEquivalent;
+    }
+
+    /**
+     * Returns <i>true</i> if this level has a higher or equal
+     * level than the level passed as argument, <i>false</i>
+     * otherwise.
+     *
+     * @param  Level   $other
+     * @return boolean
+     */
+    public function isGreaterOrEqual($other)
+    {
+        return $this->level >= $other->level;
+    }
+
+    /**
+     * Returns the string representation of this level.
+     * @return string
+     */
+    public function toString()
+    {
+        return $this->levelStr;
+    }
+
+    /**
+     * Returns the string representation of this level.
+     * @return string
+     */
+    public function __toString()
+    {
+        return $this->toString();
+    }
+
+    /**
+     * Returns the integer representation of this level.
+     * @return integer
+     */
+    public function toInt()
+    {
+        return $this->level;
+    }
+
+    /**
+     * Convert the input argument to a level. If the conversion fails, then
+     * this method returns the provided default level.
+     *
+     * @param  mixed $arg     The value to convert to level.
+     * @param  Level $default Value to return if conversion is not possible.
+     * @return Level
+     */
+    public static function toLevel($arg, $defaultLevel = null)
+    {
+        if (is_int($arg)) {
+            switch ($arg) {
+                case self::ALL:	return self::getLevelAll();
+                case self::TRACE: return self::getLevelTrace();
+                case self::DEBUG: return self::getLevelDebug();
+                case self::INFO: return self::getLevelInfo();
+                case self::WARN: return self::getLevelWarn();
+                case self::ERROR: return self::getLevelError();
+                case self::FATAL: return self::getLevelFatal();
+                case self::OFF:	return self::getLevelOff();
+                default: return $defaultLevel;
+            }
+        } else {
+            switch (strtoupper($arg)) {
+                case 'ALL':	return self::getLevelAll();
+                case 'TRACE': return self::getLevelTrace();
+                case 'DEBUG': return self::getLevelDebug();
+                case 'INFO': return self::getLevelInfo();
+                case 'WARN': return self::getLevelWarn();
+                case 'ERROR': return self::getLevelError();
+                case 'FATAL': return self::getLevelFatal();
+                case 'OFF':	return self::getLevelOff();
+                default: return $defaultLevel;
+            }
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/LocationInfo.php
----------------------------------------------------------------------
diff --git a/src/LocationInfo.php b/src/LocationInfo.php
index 4615962..bbb9fd9 100644
--- a/src/LocationInfo.php
+++ b/src/LocationInfo.php
@@ -22,79 +22,85 @@ namespace Apache\Log4php;
  * The internal representation of caller location information.
  * @since 0.3
  */
-class LocationInfo {
+class LocationInfo
+{
+    /** The value to return when the location information is not available. */
+    const LOCATION_INFO_NA = 'NA';
 
-	/** The value to return when the location information is not available. */
-	const LOCATION_INFO_NA = 'NA';
+    /**
+     * Caller line number.
+     * @var integer
+     */
+    protected $lineNumber;
 
-	/**
-	 * Caller line number.
-	 * @var integer
-	 */
-	protected $lineNumber;
+    /**
+     * Caller file name.
+     * @var string
+     */
+    protected $fileName;
 
-	/**
-	 * Caller file name.
-	 * @var string
-	 */
-	protected $fileName;
+    /**
+     * Caller class name.
+     * @var string
+     */
+    protected $className;
 
-	/**
-	 * Caller class name.
-	 * @var string
-	 */
-	protected $className;
+    /**
+     * Caller method name.
+     * @var string
+     */
+    protected $methodName;
 
-	/**
-	 * Caller method name.
-	 * @var string
-	 */
-	protected $methodName;
+    /**
+     * All the information combined.
+     * @var string
+     */
+    protected $fullInfo;
 
-	/**
-	 * All the information combined.
-	 * @var string
-	 */
-	protected $fullInfo;
+    /**
+     * Instantiate location information based on a {@link PHP_MANUAL#debug_backtrace}.
+     *
+     * @param array $trace
+     * @param mixed $caller
+     */
+    public function __construct($trace, $fqcn = null)
+    {
+        $this->lineNumber = isset($trace['line']) ? $trace['line'] : null;
+        $this->fileName = isset($trace['file']) ? $trace['file'] : null;
+        $this->className = isset($trace['class']) ? $trace['class'] : null;
+        $this->methodName = isset($trace['function']) ? $trace['function'] : null;
+        $this->fullInfo = $this->getClassName() . '.' . $this->getMethodName() .
+            '(' . $this->getFileName() . ':' . $this->getLineNumber() . ')';
+    }
 
-	/**
-	 * Instantiate location information based on a {@link PHP_MANUAL#debug_backtrace}.
-	 *
-	 * @param array $trace
-	 * @param mixed $caller
-	 */
-	public function __construct($trace, $fqcn = null) {
-		$this->lineNumber = isset($trace['line']) ? $trace['line'] : null;
-		$this->fileName = isset($trace['file']) ? $trace['file'] : null;
-		$this->className = isset($trace['class']) ? $trace['class'] : null;
-		$this->methodName = isset($trace['function']) ? $trace['function'] : null;
-		$this->fullInfo = $this->getClassName() . '.' . $this->getMethodName() .
-			'(' . $this->getFileName() . ':' . $this->getLineNumber() . ')';
-	}
+    /** Returns the caller class name. */
+    public function getClassName()
+    {
+        return ($this->className === null) ? self::LOCATION_INFO_NA : $this->className;
+    }
 
-	/** Returns the caller class name. */
-	public function getClassName() {
-		return ($this->className === null) ? self::LOCATION_INFO_NA : $this->className;
-	}
+    /** Returns the caller file name. */
+    public function getFileName()
+    {
+        return ($this->fileName === null) ? self::LOCATION_INFO_NA : $this->fileName;
+    }
 
-	/** Returns the caller file name. */
-	public function getFileName() {
-		return ($this->fileName === null) ? self::LOCATION_INFO_NA : $this->fileName;
-	}
+    /** Returns the caller line number. */
+    public function getLineNumber()
+    {
+        return ($this->lineNumber === null) ? self::LOCATION_INFO_NA : $this->lineNumber;
+    }
 
-	/** Returns the caller line number. */
-	public function getLineNumber() {
-		return ($this->lineNumber === null) ? self::LOCATION_INFO_NA : $this->lineNumber;
-	}
+    /** Returns the caller method name. */
+    public function getMethodName()
+    {
+        return ($this->methodName === null) ? self::LOCATION_INFO_NA : $this->methodName;
+    }
 
-	/** Returns the caller method name. */
-	public function getMethodName() {
-		return ($this->methodName === null) ? self::LOCATION_INFO_NA : $this->methodName;
-	}
-
-	/** Returns the full information of the caller. */
-	public function getFullInfo() {
-		return ($this->fullInfo === null) ? self::LOCATION_INFO_NA : $this->fullInfo;
-	}
+    /** Returns the full information of the caller. */
+    public function getFullInfo()
+    {
+        return ($this->fullInfo === null) ? self::LOCATION_INFO_NA : $this->fullInfo;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Logger.php
----------------------------------------------------------------------
diff --git a/src/Logger.php b/src/Logger.php
index 27eca1c..055cd34 100644
--- a/src/Logger.php
+++ b/src/Logger.php
@@ -35,558 +35,609 @@ namespace Apache\Log4php;
  * @license	http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
  * @link http://logging.apache.org/log4php
  */
-class Logger {
-
-	/**
-	 * Logger additivity. If set to true then child loggers will inherit
-	 * the appenders of their ancestors by default.
-	 * @var boolean
-	 */
-	private $additive = true;
-
-	/**
-	 * The Logger's fully qualified class name.
-	 * TODO: Determine if this is useful.
-	 */
-	private $fqcn = 'Logger';
-
-	/** The assigned Logger level. */
-	private $level;
-
-	/** The name of this Logger instance. */
-	private $name;
-
-	/** The parent logger. Set to null if this is the root logger. */
-	private $parent;
-
-	/** A collection of appenders linked to this logger. */
-	private $appenders = array();
-
-	/**
-	 * Constructor.
-	 * @param string $name Name of the logger.
-	 */
-	public function __construct($name) {
-		$this->name = $name;
-	}
-
-	/**
-	 * Returns the logger name.
-	 * @return string
-	 */
-	public function getName() {
-		return $this->name;
-	}
-
-	/**
-	 * Returns the parent Logger. Can be null if this is the root logger.
-	 * @return Logger
-	 */
-	public function getParent() {
-		return $this->parent;
-	}
-
-	// ******************************************
-	// *** Logging methods                    ***
-	// ******************************************
-
-	/**
-	 * Log a message object with the TRACE level.
-	 *
-	 * @param mixed $message message
- 	 * @param Exception $throwable Optional throwable information to include
-	 *   in the logging event.
-	 */
-	public function trace($message, $throwable = null) {
-		$this->log(Level::getLevelTrace(), $message, $throwable);
-	}
-
-	/**
-	 * Log a message object with the DEBUG level.
-	 *
-	 * @param mixed $message message
- 	 * @param Exception $throwable Optional throwable information to include
-	 *   in the logging event.
-	 */
-	public function debug($message, $throwable = null) {
-		$this->log(Level::getLevelDebug(), $message, $throwable);
-	}
-
-	/**
-	 * Log a message object with the INFO Level.
-	 *
-	 * @param mixed $message message
- 	 * @param Exception $throwable Optional throwable information to include
-	 *   in the logging event.
-	 */
-	public function info($message, $throwable = null) {
-		$this->log(Level::getLevelInfo(), $message, $throwable);
-	}
-
-	/**
-	 * Log a message with the WARN level.
-	 *
-	 * @param mixed $message message
-  	 * @param Exception $throwable Optional throwable information to include
-	 *   in the logging event.
-	 */
-	public function warn($message, $throwable = null) {
-		$this->log(Level::getLevelWarn(), $message, $throwable);
-	}
-
-	/**
-	 * Log a message object with the ERROR level.
-	 *
-	 * @param mixed $message message
-	 * @param Exception $throwable Optional throwable information to include
-	 *   in the logging event.
-	 */
-	public function error($message, $throwable = null) {
-		$this->log(Level::getLevelError(), $message, $throwable);
-	}
-
-	/**
-	 * Log a message object with the FATAL level.
-	 *
-	 * @param mixed $message message
-	 * @param Exception $throwable Optional throwable information to include
-	 *   in the logging event.
-	 */
-	public function fatal($message, $throwable = null) {
-		$this->log(Level::getLevelFatal(), $message, $throwable);
-	}
-
-	/**
-	 * Log a message using the provided logging level.
-	 *
-	 * @param Level $level The logging level.
-	 * @param mixed $message Message to log.
- 	 * @param Exception $throwable Optional throwable information to include
-	 *   in the logging event.
-	 */
-	public function log(Level $level, $message, $throwable = null) {
-		if($this->isEnabledFor($level)) {
-			$event = new LoggingEvent($this->fqcn, $this, $level, $message, null, $throwable);
-			$this->callAppenders($event);
-		}
-
-		// Forward the event upstream if additivity is turned on
-		if(isset($this->parent) && $this->getAdditivity()) {
-
-			// Use the event if already created
-			if (isset($event)) {
-				$this->parent->logEvent($event);
-			} else {
-				$this->parent->log($level, $message, $throwable);
-			}
-		}
-	}
-
-	/**
-	 * Logs an already prepared logging event object.
-	 * @param LoggingEvent $event
-	 */
-	public function logEvent(LoggingEvent $event) {
-		if($this->isEnabledFor($event->getLevel())) {
-			$this->callAppenders($event);
-		}
-
-		// Forward the event upstream if additivity is turned on
-		if(isset($this->parent) && $this->getAdditivity()) {
-			$this->parent->logEvent($event);
-		}
-	}
-
-	/**
-	 * If assertion parameter evaluates as false, then logs the message
-	 * using the ERROR level.
-	 *
-	 * @param bool $assertion
-	 * @param string $msg message to log
-	 */
-	public function assertLog($assertion = true, $msg = '') {
-		if($assertion == false) {
-			$this->error($msg);
-		}
-	}
-
-	/**
-	 * This method creates a new logging event and logs the event without
-	 * further checks.
-	 *
-	 * It should not be called directly. Use {@link trace()}, {@link debug()},
-	 * {@link info()}, {@link warn()}, {@link error()} and {@link fatal()}
-	 * wrappers.
-	 *
-	 * @param string $fqcn Fully qualified class name of the Logger
-	 * @param Exception $throwable Optional throwable information to include
-	 *   in the logging event.
-	 * @param Level $level log level
-	 * @param mixed $message message to log
-	 */
-	public function forcedLog($fqcn, $throwable, Level $level, $message) {
-		$event = new LoggingEvent($fqcn, $this, $level, $message, null, $throwable);
-		$this->callAppenders($event);
-
-		// Forward the event upstream if additivity is turned on
-		if(isset($this->parent) && $this->getAdditivity()) {
-			$this->parent->logEvent($event);
-		}
-	}
-
-	/**
-	 * Forwards the given logging event to all linked appenders.
-	 * @param LoggingEvent $event
-	 */
-	public function callAppenders($event) {
-		foreach($this->appenders as $appender) {
-			$appender->doAppend($event);
-		}
-	}
-
-	// ******************************************
-	// *** Checker methods                    ***
-	// ******************************************
-
-	/**
-	 * Check whether this Logger is enabled for a given Level passed as parameter.
-	 *
-	 * @param Level level
-	 * @return boolean
-	 */
-	public function isEnabledFor(Level $level) {
-		return $level->isGreaterOrEqual($this->getEffectiveLevel());
-	}
-
-	/**
-	 * Check whether this Logger is enabled for the TRACE Level.
-	 * @return boolean
-	 */
-	public function isTraceEnabled() {
-		return $this->isEnabledFor(Level::getLevelTrace());
-	}
-
-	/**
-	 * Check whether this Logger is enabled for the DEBUG Level.
-	 * @return boolean
-	 */
-	public function isDebugEnabled() {
-		return $this->isEnabledFor(Level::getLevelDebug());
-	}
-
-	/**
-	 * Check whether this Logger is enabled for the INFO Level.
-	 * @return boolean
-	 */
-	public function isInfoEnabled() {
-		return $this->isEnabledFor(Level::getLevelInfo());
-	}
-
-	/**
-	 * Check whether this Logger is enabled for the WARN Level.
-	 * @return boolean
-	 */
-	public function isWarnEnabled() {
-		return $this->isEnabledFor(Level::getLevelWarn());
-	}
-
-	/**
-	 * Check whether this Logger is enabled for the ERROR Level.
-	 * @return boolean
-	 */
-	public function isErrorEnabled() {
-		return $this->isEnabledFor(Level::getLevelError());
-	}
-
-	/**
-	 * Check whether this Logger is enabled for the FATAL Level.
-	 * @return boolean
-	 */
-	public function isFatalEnabled() {
-		return $this->isEnabledFor(Level::getLevelFatal());
-	}
-
-	// ******************************************
-	// *** Configuration methods              ***
-	// ******************************************
-
-	/**
-	 * Adds a new appender to the Logger.
-	 * @param Appender $appender The appender to add.
-	 */
-	public function addAppender($appender) {
-		$appenderName = $appender->getName();
-		$this->appenders[$appenderName] = $appender;
-	}
-
-	/** Removes all appenders from the Logger. */
-	public function removeAllAppenders() {
-		foreach($this->appenders as $name => $appender) {
-			$this->removeAppender($name);
-		}
-	}
-
-	/**
-	 * Remove the appender passed as parameter form the Logger.
-	 * @param mixed $appender an appender name or a {@link Appender} instance.
-	 */
-	public function removeAppender($appender) {
-		if($appender instanceof Appender) {
-			$appender->close();
-			unset($this->appenders[$appender->getName()]);
-		} else if (is_string($appender) and isset($this->appenders[$appender])) {
-			$this->appenders[$appender]->close();
-			unset($this->appenders[$appender]);
-		}
-	}
-
-	/**
-	 * Returns the appenders linked to this logger as an array.
-	 * @return array collection of appender names
-	 */
-	public function getAllAppenders() {
-		return $this->appenders;
-	}
-
-	/**
-	 * Returns a linked appender by name.
-	 * @return Appender
-	 */
-	public function getAppender($name) {
-		return $this->appenders[$name];
-	}
-
-	/**
-	 * Sets the additivity flag.
-	 * @param boolean $additive
-	 */
-	public function setAdditivity($additive) {
-		$this->additive = (bool)$additive;
-	}
-
-	/**
-	 * Returns the additivity flag.
-	 * @return boolean
-	 */
-	public function getAdditivity() {
-		return $this->additive;
-	}
-
-	/**
-	 * Starting from this Logger, search the Logger hierarchy for a non-null level and return it.
-	 * @see Level
-	 * @return Level or null
-	 */
-	public function getEffectiveLevel() {
-		for($logger = $this; $logger !== null; $logger = $logger->getParent()) {
-			if($logger->getLevel() !== null) {
-				return $logger->getLevel();
-			}
-		}
-	}
-
-	/**
-	 * Get the assigned Logger level.
-	 * @return Level The assigned level or null if none is assigned.
-	 */
-	public function getLevel() {
-		return $this->level;
-	}
-
-	/**
-	 * Set the Logger level.
-	 *
-	 * Use Level::getLevelXXX() methods to get a Level object, e.g.
-	 * <code>$logger->setLevel(Level::getLevelInfo());</code>
-	 *
-	 * @param Level $level The level to set, or NULL to clear the logger level.
-	 */
-	public function setLevel(Level $level = null) {
-		$this->level = $level;
-	}
-
-	/**
-	 * Checks whether an appender is attached to this logger instance.
-	 *
-	 * @param Appender $appender
-	 * @return boolean
-	 */
-	public function isAttached(Appender $appender) {
-		return isset($this->appenders[$appender->getName()]);
-	}
-
-	/**
-	 * Sets the parent logger.
-	 * @param Logger $logger
-	 */
-	public function setParent(Logger $logger) {
-		$this->parent = $logger;
-	}
-
-	// ******************************************
-	// *** Static methods and properties      ***
-	// ******************************************
-
-	/** The logger hierarchy used by log4php. */
-	private static $hierarchy;
-
-	/** Inidicates if log4php has been initialized */
-	private static $initialized = false;
-
-	/**
-	 * Returns the hierarchy used by this Logger.
-	 *
-	 * Caution: do not use this hierarchy unless you have called initialize().
-	 * To get Loggers, use the Logger::getLogger and Logger::getRootLogger
-	 * methods instead of operating on on the hierarchy directly.
-	 *
-	 * @return Hierarchy
-	 */
-	public static function getHierarchy() {
-		if(!isset(self::$hierarchy)) {
-			self::$hierarchy = new Hierarchy(new RootLogger());
-		}
-		return self::$hierarchy;
-	}
-
-	/**
-	 * Returns a Logger by name. If it does not exist, it will be created.
-	 *
-	 * @param string $name The logger name
-	 * @return Logger
-	 */
-	public static function getLogger($name) {
-		if(!self::isInitialized()) {
-			self::configure();
-		}
-		return self::getHierarchy()->getLogger($name);
-	}
-
-	/**
-	 * Returns the Root Logger.
-	 * @return RootLogger
-	 */
-	public static function getRootLogger() {
-		if(!self::isInitialized()) {
-			self::configure();
-		}
-		return self::getHierarchy()->getRootLogger();
-	}
-
-	/**
-	 * Clears all Logger definitions from the logger hierarchy.
-	 * @return boolean
-	 */
-	public static function clear() {
-		return self::getHierarchy()->clear();
-	}
-
-	/**
-	 * Destroy configurations for logger definitions
-	 */
-	public static function resetConfiguration() {
-		self::getHierarchy()->resetConfiguration();
-		self::getHierarchy()->clear(); // TODO: clear or not?
-		self::$initialized = false;
-	}
-
-	/**
-	 * Safely close all appenders.
-	 * @deprecated This is no longer necessary due the appenders shutdown via
-	 * destructors.
-	 */
-	public static function shutdown() {
-		return self::getHierarchy()->shutdown();
-	}
-
-	/**
-	 * check if a given logger exists.
-	 *
-	 * @param string $name logger name
-	 * @return boolean
-	 */
-	public static function exists($name) {
-		return self::getHierarchy()->exists($name);
-	}
-
-	/**
-	 * Returns an array this whole Logger instances.
-	 * @see Logger
-	 * @return array
-	 */
-	public static function getCurrentLoggers() {
-		return self::getHierarchy()->getCurrentLoggers();
-	}
-
-	/**
-	 * Configures log4php.
-	 *
-	 * This method needs to be called before the first logging event has
-	 * occured. If this method is not called before then the default
-	 * configuration will be used.
-	 *
-	 * @param string|array $configuration Either a path to the configuration
-	 *   file, or a configuration array.
-	 *
-	 * @param string|Configurator $configurator A custom
-	 * configurator class: either a class name (string), or an object which
-	 * implements the Configurator interface. If left empty, the default
-	 * configurator implementation will be used.
-	 */
-	public static function configure($configuration = null, $configurator = null) {
-		self::resetConfiguration();
-		$configurator = self::getConfigurator($configurator);
-		$configurator->configure(self::getHierarchy(), $configuration);
-		self::$initialized = true;
-	}
-
-	/**
-	 * Creates a logger configurator instance based on the provided
-	 * configurator class. If no class is given, returns an instance of
-	 * the default configurator.
-	 *
-	 * @param string|Configurator $configurator The configurator class
-	 * or Configurator instance.
-	 */
-	private static function getConfigurator($configurator = null) {
-		if ($configurator === null) {
-			return new Configuration\DefaultConfigurator();
-		}
-
-		if (is_object($configurator)) {
-			if ($configurator instanceof Configurator) {
-				return $configurator;
-			} else {
-				trigger_error("log4php: Given configurator object [$configurator] does not implement the Configurator interface. Reverting to default configurator.", E_USER_WARNING);
-				return new Configuration\DefaultConfigurator();
-			}
-		}
-
-		if (is_string($configurator)) {
-			if (!class_exists($configurator)) {
-				trigger_error("log4php: Specified configurator class [$configurator] does not exist. Reverting to default configurator.", E_USER_WARNING);
-				return new Configuration\DefaultConfigurator();
-			}
-
-			$instance = new $configurator();
-
-			if (!($instance instanceof Configurator)) {
-				trigger_error("log4php: Specified configurator class [$configurator] does not implement the Configurator interface. Reverting to default configurator.", E_USER_WARNING);
-				return new Configuration\DefaultConfigurator();
-			}
-
-			return $instance;
-		}
-
-		trigger_error("log4php: Invalid configurator specified. Expected either a string or a Configurator instance. Reverting to default configurator.", E_USER_WARNING);
-		return new Configuration\DefaultConfigurator();
-	}
-
-	/**
-	 * Returns true if the log4php framework has been initialized.
-	 * @return boolean
-	 */
-	private static function isInitialized() {
-		return self::$initialized;
-	}
+class Logger
+{
+    /**
+     * Logger additivity. If set to true then child loggers will inherit
+     * the appenders of their ancestors by default.
+     * @var boolean
+     */
+    private $additive = true;
+
+    /**
+     * The Logger's fully qualified class name.
+     * TODO: Determine if this is useful.
+     */
+    private $fqcn = 'Logger';
+
+    /** The assigned Logger level. */
+    private $level;
+
+    /** The name of this Logger instance. */
+    private $name;
+
+    /** The parent logger. Set to null if this is the root logger. */
+    private $parent;
+
+    /** A collection of appenders linked to this logger. */
+    private $appenders = array();
+
+    /**
+     * Constructor.
+     * @param string $name Name of the logger.
+     */
+    public function __construct($name)
+    {
+        $this->name = $name;
+    }
+
+    /**
+     * Returns the logger name.
+     * @return string
+     */
+    public function getName()
+    {
+        return $this->name;
+    }
+
+    /**
+     * Returns the parent Logger. Can be null if this is the root logger.
+     * @return Logger
+     */
+    public function getParent()
+    {
+        return $this->parent;
+    }
+
+    // ******************************************
+    // *** Logging methods                    ***
+    // ******************************************
+
+    /**
+     * Log a message object with the TRACE level.
+     *
+     * @param mixed $message message
+      * @param Exception $throwable Optional throwable information to include
+     *   in the logging event.
+     */
+    public function trace($message, $throwable = null)
+    {
+        $this->log(Level::getLevelTrace(), $message, $throwable);
+    }
+
+    /**
+     * Log a message object with the DEBUG level.
+     *
+     * @param mixed $message message
+      * @param Exception $throwable Optional throwable information to include
+     *   in the logging event.
+     */
+    public function debug($message, $throwable = null)
+    {
+        $this->log(Level::getLevelDebug(), $message, $throwable);
+    }
+
+    /**
+     * Log a message object with the INFO Level.
+     *
+     * @param mixed $message message
+      * @param Exception $throwable Optional throwable information to include
+     *   in the logging event.
+     */
+    public function info($message, $throwable = null)
+    {
+        $this->log(Level::getLevelInfo(), $message, $throwable);
+    }
+
+    /**
+     * Log a message with the WARN level.
+     *
+     * @param mixed $message message
+       * @param Exception $throwable Optional throwable information to include
+     *   in the logging event.
+     */
+    public function warn($message, $throwable = null)
+    {
+        $this->log(Level::getLevelWarn(), $message, $throwable);
+    }
+
+    /**
+     * Log a message object with the ERROR level.
+     *
+     * @param mixed     $message   message
+     * @param Exception $throwable Optional throwable information to include
+     *   in the logging event.
+     */
+    public function error($message, $throwable = null)
+    {
+        $this->log(Level::getLevelError(), $message, $throwable);
+    }
+
+    /**
+     * Log a message object with the FATAL level.
+     *
+     * @param mixed     $message   message
+     * @param Exception $throwable Optional throwable information to include
+     *   in the logging event.
+     */
+    public function fatal($message, $throwable = null)
+    {
+        $this->log(Level::getLevelFatal(), $message, $throwable);
+    }
+
+    /**
+     * Log a message using the provided logging level.
+     *
+     * @param Level $level   The logging level.
+     * @param mixed $message Message to log.
+      * @param Exception $throwable Optional throwable information to include
+     *   in the logging event.
+     */
+    public function log(Level $level, $message, $throwable = null)
+    {
+        if ($this->isEnabledFor($level)) {
+            $event = new LoggingEvent($this->fqcn, $this, $level, $message, null, $throwable);
+            $this->callAppenders($event);
+        }
+
+        // Forward the event upstream if additivity is turned on
+        if (isset($this->parent) && $this->getAdditivity()) {
+
+            // Use the event if already created
+            if (isset($event)) {
+                $this->parent->logEvent($event);
+            } else {
+                $this->parent->log($level, $message, $throwable);
+            }
+        }
+    }
+
+    /**
+     * Logs an already prepared logging event object.
+     * @param LoggingEvent $event
+     */
+    public function logEvent(LoggingEvent $event)
+    {
+        if ($this->isEnabledFor($event->getLevel())) {
+            $this->callAppenders($event);
+        }
+
+        // Forward the event upstream if additivity is turned on
+        if (isset($this->parent) && $this->getAdditivity()) {
+            $this->parent->logEvent($event);
+        }
+    }
+
+    /**
+     * If assertion parameter evaluates as false, then logs the message
+     * using the ERROR level.
+     *
+     * @param bool   $assertion
+     * @param string $msg       message to log
+     */
+    public function assertLog($assertion = true, $msg = '')
+    {
+        if ($assertion == false) {
+            $this->error($msg);
+        }
+    }
+
+    /**
+     * This method creates a new logging event and logs the event without
+     * further checks.
+     *
+     * It should not be called directly. Use {@link trace()}, {@link debug()},
+     * {@link info()}, {@link warn()}, {@link error()} and {@link fatal()}
+     * wrappers.
+     *
+     * @param string    $fqcn      Fully qualified class name of the Logger
+     * @param Exception $throwable Optional throwable information to include
+     *   in the logging event.
+     * @param Level $level   log level
+     * @param mixed $message message to log
+     */
+    public function forcedLog($fqcn, $throwable, Level $level, $message)
+    {
+        $event = new LoggingEvent($fqcn, $this, $level, $message, null, $throwable);
+        $this->callAppenders($event);
+
+        // Forward the event upstream if additivity is turned on
+        if (isset($this->parent) && $this->getAdditivity()) {
+            $this->parent->logEvent($event);
+        }
+    }
+
+    /**
+     * Forwards the given logging event to all linked appenders.
+     * @param LoggingEvent $event
+     */
+    public function callAppenders($event)
+    {
+        foreach ($this->appenders as $appender) {
+            $appender->doAppend($event);
+        }
+    }
+
+    // ******************************************
+    // *** Checker methods                    ***
+    // ******************************************
+
+    /**
+     * Check whether this Logger is enabled for a given Level passed as parameter.
+     *
+     * @param Level level
+     * @return boolean
+     */
+    public function isEnabledFor(Level $level)
+    {
+        return $level->isGreaterOrEqual($this->getEffectiveLevel());
+    }
+
+    /**
+     * Check whether this Logger is enabled for the TRACE Level.
+     * @return boolean
+     */
+    public function isTraceEnabled()
+    {
+        return $this->isEnabledFor(Level::getLevelTrace());
+    }
+
+    /**
+     * Check whether this Logger is enabled for the DEBUG Level.
+     * @return boolean
+     */
+    public function isDebugEnabled()
+    {
+        return $this->isEnabledFor(Level::getLevelDebug());
+    }
+
+    /**
+     * Check whether this Logger is enabled for the INFO Level.
+     * @return boolean
+     */
+    public function isInfoEnabled()
+    {
+        return $this->isEnabledFor(Level::getLevelInfo());
+    }
+
+    /**
+     * Check whether this Logger is enabled for the WARN Level.
+     * @return boolean
+     */
+    public function isWarnEnabled()
+    {
+        return $this->isEnabledFor(Level::getLevelWarn());
+    }
+
+    /**
+     * Check whether this Logger is enabled for the ERROR Level.
+     * @return boolean
+     */
+    public function isErrorEnabled()
+    {
+        return $this->isEnabledFor(Level::getLevelError());
+    }
+
+    /**
+     * Check whether this Logger is enabled for the FATAL Level.
+     * @return boolean
+     */
+    public function isFatalEnabled()
+    {
+        return $this->isEnabledFor(Level::getLevelFatal());
+    }
+
+    // ******************************************
+    // *** Configuration methods              ***
+    // ******************************************
+
+    /**
+     * Adds a new appender to the Logger.
+     * @param Appender $appender The appender to add.
+     */
+    public function addAppender($appender)
+    {
+        $appenderName = $appender->getName();
+        $this->appenders[$appenderName] = $appender;
+    }
+
+    /** Removes all appenders from the Logger. */
+    public function removeAllAppenders()
+    {
+        foreach ($this->appenders as $name => $appender) {
+            $this->removeAppender($name);
+        }
+    }
+
+    /**
+     * Remove the appender passed as parameter form the Logger.
+     * @param mixed $appender an appender name or a {@link Appender} instance.
+     */
+    public function removeAppender($appender)
+    {
+        if ($appender instanceof Appender) {
+            $appender->close();
+            unset($this->appenders[$appender->getName()]);
+        } elseif (is_string($appender) and isset($this->appenders[$appender])) {
+            $this->appenders[$appender]->close();
+            unset($this->appenders[$appender]);
+        }
+    }
+
+    /**
+     * Returns the appenders linked to this logger as an array.
+     * @return array collection of appender names
+     */
+    public function getAllAppenders()
+    {
+        return $this->appenders;
+    }
+
+    /**
+     * Returns a linked appender by name.
+     * @return Appender
+     */
+    public function getAppender($name)
+    {
+        return $this->appenders[$name];
+    }
+
+    /**
+     * Sets the additivity flag.
+     * @param boolean $additive
+     */
+    public function setAdditivity($additive)
+    {
+        $this->additive = (bool) $additive;
+    }
+
+    /**
+     * Returns the additivity flag.
+     * @return boolean
+     */
+    public function getAdditivity()
+    {
+        return $this->additive;
+    }
+
+    /**
+     * Starting from this Logger, search the Logger hierarchy for a non-null level and return it.
+     * @see Level
+     * @return Level or null
+     */
+    public function getEffectiveLevel()
+    {
+        for ($logger = $this; $logger !== null; $logger = $logger->getParent()) {
+            if ($logger->getLevel() !== null) {
+                return $logger->getLevel();
+            }
+        }
+    }
+
+    /**
+     * Get the assigned Logger level.
+     * @return Level The assigned level or null if none is assigned.
+     */
+    public function getLevel()
+    {
+        return $this->level;
+    }
+
+    /**
+     * Set the Logger level.
+     *
+     * Use Level::getLevelXXX() methods to get a Level object, e.g.
+     * <code>$logger->setLevel(Level::getLevelInfo());</code>
+     *
+     * @param Level $level The level to set, or NULL to clear the logger level.
+     */
+    public function setLevel(Level $level = null)
+    {
+        $this->level = $level;
+    }
+
+    /**
+     * Checks whether an appender is attached to this logger instance.
+     *
+     * @param  Appender $appender
+     * @return boolean
+     */
+    public function isAttached(Appender $appender)
+    {
+        return isset($this->appenders[$appender->getName()]);
+    }
+
+    /**
+     * Sets the parent logger.
+     * @param Logger $logger
+     */
+    public function setParent(Logger $logger)
+    {
+        $this->parent = $logger;
+    }
+
+    // ******************************************
+    // *** Static methods and properties      ***
+    // ******************************************
+
+    /** The logger hierarchy used by log4php. */
+    private static $hierarchy;
+
+    /** Inidicates if log4php has been initialized */
+    private static $initialized = false;
+
+    /**
+     * Returns the hierarchy used by this Logger.
+     *
+     * Caution: do not use this hierarchy unless you have called initialize().
+     * To get Loggers, use the Logger::getLogger and Logger::getRootLogger
+     * methods instead of operating on on the hierarchy directly.
+     *
+     * @return Hierarchy
+     */
+    public static function getHierarchy()
+    {
+        if (!isset(self::$hierarchy)) {
+            self::$hierarchy = new Hierarchy(new RootLogger());
+        }
+
+        return self::$hierarchy;
+    }
+
+    /**
+     * Returns a Logger by name. If it does not exist, it will be created.
+     *
+     * @param  string $name The logger name
+     * @return Logger
+     */
+    public static function getLogger($name)
+    {
+        if (!self::isInitialized()) {
+            self::configure();
+        }
+
+        return self::getHierarchy()->getLogger($name);
+    }
+
+    /**
+     * Returns the Root Logger.
+     * @return RootLogger
+     */
+    public static function getRootLogger()
+    {
+        if (!self::isInitialized()) {
+            self::configure();
+        }
+
+        return self::getHierarchy()->getRootLogger();
+    }
+
+    /**
+     * Clears all Logger definitions from the logger hierarchy.
+     * @return boolean
+     */
+    public static function clear()
+    {
+        return self::getHierarchy()->clear();
+    }
+
+    /**
+     * Destroy configurations for logger definitions
+     */
+    public static function resetConfiguration()
+    {
+        self::getHierarchy()->resetConfiguration();
+        self::getHierarchy()->clear(); // TODO: clear or not?
+        self::$initialized = false;
+    }
+
+    /**
+     * Safely close all appenders.
+     * @deprecated This is no longer necessary due the appenders shutdown via
+     * destructors.
+     */
+    public static function shutdown()
+    {
+        return self::getHierarchy()->shutdown();
+    }
+
+    /**
+     * check if a given logger exists.
+     *
+     * @param  string  $name logger name
+     * @return boolean
+     */
+    public static function exists($name)
+    {
+        return self::getHierarchy()->exists($name);
+    }
+
+    /**
+     * Returns an array this whole Logger instances.
+     * @see Logger
+     * @return array
+     */
+    public static function getCurrentLoggers()
+    {
+        return self::getHierarchy()->getCurrentLoggers();
+    }
+
+    /**
+     * Configures log4php.
+     *
+     * This method needs to be called before the first logging event has
+     * occured. If this method is not called before then the default
+     * configuration will be used.
+     *
+     * @param string|array $configuration Either a path to the configuration
+     *   file, or a configuration array.
+     *
+     * @param string|Configurator $configurator A custom
+     * configurator class: either a class name (string) , or an object which
+     * implements the Configurator interface. If left empty, the default
+     * configurator implementation will be used.
+     */
+    public static function configure($configuration = null, $configurator = null)
+    {
+        self::resetConfiguration();
+        $configurator = self::getConfigurator($configurator);
+        $configurator->configure(self::getHierarchy(), $configuration);
+        self::$initialized = true;
+    }
+
+    /**
+     * Creates a logger configurator instance based on the provided
+     * configurator class. If no class is given, returns an instance of
+     * the default configurator.
+     *
+     * @param string|Configurator $configurator The configurator class
+     * or Configurator instance.
+     */
+    private static function getConfigurator($configurator = null)
+    {
+        if ($configurator === null) {
+            return new Configuration\DefaultConfigurator();
+        }
+
+        if (is_object($configurator)) {
+            if ($configurator instanceof Configurator) {
+                return $configurator;
+            } else {
+                trigger_error("log4php: Given configurator object [$configurator] does not implement the Configurator interface. Reverting to default configurator.", E_USER_WARNING);
+
+                return new Configuration\DefaultConfigurator();
+            }
+        }
+
+        if (is_string($configurator)) {
+            if (!class_exists($configurator)) {
+                trigger_error("log4php: Specified configurator class [$configurator] does not exist. Reverting to default configurator.", E_USER_WARNING);
+
+                return new Configuration\DefaultConfigurator();
+            }
+
+            $instance = new $configurator();
+
+            if (!($instance instanceof Configurator)) {
+                trigger_error("log4php: Specified configurator class [$configurator] does not implement the Configurator interface. Reverting to default configurator.", E_USER_WARNING);
+
+                return new Configuration\DefaultConfigurator();
+            }
+
+            return $instance;
+        }
+
+        trigger_error("log4php: Invalid configurator specified. Expected either a string or a Configurator instance. Reverting to default configurator.", E_USER_WARNING);
+
+        return new Configuration\DefaultConfigurator();
+    }
+
+    /**
+     * Returns true if the log4php framework has been initialized.
+     * @return boolean
+     */
+    private static function isInitialized()
+    {
+        return self::$initialized;
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/LoggerException.php
----------------------------------------------------------------------
diff --git a/src/LoggerException.php b/src/LoggerException.php
index 103c532..3641e90 100644
--- a/src/LoggerException.php
+++ b/src/LoggerException.php
@@ -21,5 +21,6 @@ namespace Apache\Log4php;
 /**
  * LoggerException class
  */
-class LoggerException extends \Exception {
+class LoggerException extends \Exception
+{
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/LoggingEvent.php
----------------------------------------------------------------------
diff --git a/src/LoggingEvent.php b/src/LoggingEvent.php
index f0fd7e3..0167c6a 100644
--- a/src/LoggingEvent.php
+++ b/src/LoggingEvent.php
@@ -21,345 +21,370 @@ namespace Apache\Log4php;
 /**
  * The internal representation of logging event.
  */
-class LoggingEvent {
-
-	private static $startTime;
-
-	/**
-	* @var string Fully Qualified Class Name of the calling category class.
-	*/
-	private $fqcn;
-
-	/**
-	* @var Logger reference
-	*/
-	private $logger;
-
-	/**
-	 * The category (logger) name.
-	 * This field will be marked as private in future
-	 * releases. Please do not access it directly.
-	 * Use the {@link getLoggerName()} method instead.
-	 * @deprecated
-	 */
-	private $categoryName;
-
-	/**
-	 * Level of the logging event.
-	 * @var Level
-	 */
-	protected $level;
-
-	/**
-	 * The nested diagnostic context (NDC) of logging event.
-	 * @var string
-	 */
-	private $ndc;
-
-	/**
-	 * Have we tried to do an NDC lookup? If we did, there is no need
-	 * to do it again.	Note that its value is always false when
-	 * serialized. Thus, a receiving SocketNode will never use it's own
-	 * (incorrect) NDC. See also writeObject method.
-	 * @var boolean
-	 */
-	private $ndcLookupRequired = true;
-
-	/**
-	 * @var mixed The application supplied message of logging event.
-	 */
-	private $message;
-
-	/**
-	 * The application supplied message rendered through the log4php
-	 * objet rendering mechanism. At present renderedMessage == message.
-	 * @var string
-	 */
-	private $renderedMessage;
-
-	/**
-	 * The name of thread in which this logging event was generated.
-	 * log4php saves here the process id via {@link PHP_MANUAL#getmypid getmypid()}
-	 * @var mixed
-	 */
-	private $threadName;
-
-	/**
-	* The number of seconds elapsed from 1/1/1970 until logging event
-	* was created plus microseconds if available.
-	* @var float
-	*/
-	public $timeStamp;
-
-	/**
-	* @var LocationInfo Location information for the caller.
-	*/
-	private $locationInfo;
-
-	/**
-	 * @var ThrowableInformation log4php internal representation of throwable
-	 */
-	private $throwableInfo;
-
-	/**
-	* Instantiate a LoggingEvent from the supplied parameters.
-	*
-	* Except {@link $timeStamp} all the other fields of
-	* LoggingEvent are filled when actually needed.
-	*
-	* @param string $fqcn name of the caller class.
-	* @param mixed $logger The {@link Logger} category of this event or the logger name.
-	* @param Level $level The level of this event.
-	* @param mixed $message The message of this event.
-	* @param integer $timeStamp the timestamp of this logging event.
-	* @param Exception $throwable The throwable associated with logging event
-	*/
-	public function __construct($fqcn, $logger, Level $level, $message, $timeStamp = null, $throwable = null) {
-		$this->fqcn = $fqcn;
-		if($logger instanceof Logger) {
-			$this->logger = $logger;
-			$this->categoryName = $logger->getName();
-		} else {
-			$this->categoryName = strval($logger);
-		}
-		$this->level = $level;
-		$this->message = $message;
-		if($timeStamp !== null && is_numeric($timeStamp)) {
-			$this->timeStamp = $timeStamp;
-		} else {
-			$this->timeStamp = microtime(true);
-		}
-
-		if (isset($throwable) && $throwable instanceof \Exception) {
-			$this->throwableInfo = new ThrowableInformation($throwable);
-		}
-	}
-
-	/**
-	 * Returns the full qualified classname.
-	 * TODO: PHP does contain namespaces in 5.3. Those should be returned too,
-	 */
-	 public function getFullQualifiedClassname() {
-		 return $this->fqcn;
-	 }
-
-	/**
-	 * Set the location information for this logging event. The collected
-	 * information is cached for future use.
-	 *
-	 * <p>This method uses {@link PHP_MANUAL#debug_backtrace debug_backtrace()} function (if exists)
-	 * to collect informations about caller.</p>
-	 * <p>It only recognize informations generated by {@link Logger} and its subclasses.</p>
-	 * @return LocationInfo
-	 */
-	public function getLocationInformation() {
-		if($this->locationInfo === null) {
-
-			$locationInfo = array();
-			$trace = debug_backtrace();
-			$prevHop = null;
-
-			// make a downsearch to identify the caller
-			$hop = array_pop($trace);
-			while($hop !== null) {
-				if(isset($hop['class'])) {
-					$className = $hop['class'];
-
-					if($className === "Apache\\Log4php\\Logger" ||
-						$className === "Apache\\Log4php\\RootLogger") {
-						$locationInfo['line'] = $hop['line'];
-						$locationInfo['file'] = $hop['file'];
-						break;
-					}
-				}
-				$prevHop = $hop;
-				$hop = array_pop($trace);
-			}
-			$locationInfo['class'] = isset($prevHop['class']) ? $prevHop['class'] : 'main';
-			if(isset($prevHop['function']) and
-				$prevHop['function'] !== 'include' and
-				$prevHop['function'] !== 'include_once' and
-				$prevHop['function'] !== 'require' and
-				$prevHop['function'] !== 'require_once') {
-
-				$locationInfo['function'] = $prevHop['function'];
-			} else {
-				$locationInfo['function'] = 'main';
-			}
-
-			$this->locationInfo = new LocationInfo($locationInfo, $this->fqcn);
-		}
-		return $this->locationInfo;
-	}
-
-	/**
-	 * Return the level of this event. Use this form instead of directly
-	 * accessing the {@link $level} field.
-	 * @return Level
-	 */
-	public function getLevel() {
-		return $this->level;
-	}
-
-	/**
-	 * Returns the logger which created the event.
-	 * @return Logger
-	 */
-	public function getLogger() {
-		return $this->logger;
-	}
-
-	/**
-	 * Return the name of the logger. Use this form instead of directly
-	 * accessing the {@link $categoryName} field.
-	 * @return string
-	 */
-	public function getLoggerName() {
-		return $this->categoryName;
-	}
-
-	/**
-	 * Return the message for this logging event.
-	 * @return mixed
-	 */
-	public function getMessage() {
-		return $this->message;
-	}
-
-	/**
-	 * This method returns the NDC for this event. It will return the
-	 * correct content even if the event was generated in a different
-	 * thread or even on a different machine. The {@link NDC::get()} method
-	 * should <b>never</b> be called directly.
-	 * @return string
-	 */
-	public function getNDC() {
-		if($this->ndcLookupRequired) {
-			$this->ndcLookupRequired = false;
-			$this->ndc = NDC::get();
-		}
-		return $this->ndc;
-	}
-
-	/**
-	 * Returns the the context corresponding to the <code>key</code>
-	 * parameter.
-	 * @return string
-	 */
-	public function getMDC($key) {
-		return MDC::get($key);
-	}
-
-	/**
-	 * Returns the entire MDC context.
-	 * @return array
-	 */
-	public function getMDCMap () {
-		return MDC::getMap();
-	}
-
-	/**
-	 * Render message.
-	 * @return string
-	 */
-	public function getRenderedMessage() {
-		if($this->renderedMessage === null and $this->message !== null) {
-			if(is_string($this->message)) {
-				$this->renderedMessage = $this->message;
-			} else {
-				$rendererMap = Logger::getHierarchy()->getRendererMap();
-				$this->renderedMessage= $rendererMap->findAndRender($this->message);
-			}
-		}
-		return $this->renderedMessage;
-	}
-
-	/**
-	 * Returns the time when the application started, as a UNIX timestamp
-	 * with microseconds.
-	 * @return float
-	 */
-	public static function getStartTime() {
-		if(!isset(self::$startTime)) {
-			self::$startTime = microtime(true);
-		}
-		return self::$startTime;
-	}
-
-	/**
-	 * @return float
-	 */
-	public function getTimeStamp() {
-		return $this->timeStamp;
-	}
-
-	/**
-	 * Returns the time in seconds passed from the beginning of execution to
-	 * the time the event was constructed.
-	 *
-	 * @return float Seconds with microseconds in decimals.
-	 */
-	public function getRelativeTime() {
-		return $this->timeStamp - self::$startTime;
-	}
-
-	/**
-	 * Returns the time in milliseconds passed from the beginning of execution
-	 * to the time the event was constructed.
-	 *
-	 * @deprecated This method has been replaced by getRelativeTime which
-	 * 		does not perform unneccesary multiplication and formatting.
-	 *
-	 * @return integer
-	 */
-	public function getTime() {
-		$eventTime = $this->getTimeStamp();
-		$eventStartTime = LoggingEvent::getStartTime();
-		return number_format(($eventTime - $eventStartTime) * 1000, 0, '', '');
-	}
-
-	/**
-	 * @return mixed
-	 */
-	public function getThreadName() {
-		if ($this->threadName === null) {
-			$this->threadName = (string)getmypid();
-		}
-		return $this->threadName;
-	}
-
-	/**
-	 * @return mixed ThrowableInformation
-	 */
-	public function getThrowableInformation() {
-		return $this->throwableInfo;
-	}
-
-	/**
-	 * Serialize this object
-	 * @return string
-	 */
-	public function toString() {
-		serialize($this);
-	}
-
-	/**
-	 * Avoid serialization of the {@link $logger} object
-	 */
-	public function __sleep() {
-		return array(
-			'fqcn',
-			'categoryName',
-			'level',
-			'ndc',
-			'ndcLookupRequired',
-			'message',
-			'renderedMessage',
-			'threadName',
-			'timeStamp',
-			'locationInfo',
-		);
-	}
+class LoggingEvent
+{
+    private static $startTime;
+
+    /**
+    * @var string Fully Qualified Class Name of the calling category class.
+    */
+    private $fqcn;
+
+    /**
+    * @var Logger reference
+    */
+    private $logger;
+
+    /**
+     * The category (logger) name.
+     * This field will be marked as private in future
+     * releases. Please do not access it directly.
+     * Use the {@link getLoggerName()} method instead.
+     * @deprecated
+     */
+    private $categoryName;
+
+    /**
+     * Level of the logging event.
+     * @var Level
+     */
+    protected $level;
+
+    /**
+     * The nested diagnostic context (NDC) of logging event.
+     * @var string
+     */
+    private $ndc;
+
+    /**
+     * Have we tried to do an NDC lookup? If we did, there is no need
+     * to do it again.	Note that its value is always false when
+     * serialized. Thus, a receiving SocketNode will never use it's own
+     * (incorrect) NDC. See also writeObject method.
+     * @var boolean
+     */
+    private $ndcLookupRequired = true;
+
+    /**
+     * @var mixed The application supplied message of logging event.
+     */
+    private $message;
+
+    /**
+     * The application supplied message rendered through the log4php
+     * objet rendering mechanism. At present renderedMessage == message.
+     * @var string
+     */
+    private $renderedMessage;
+
+    /**
+     * The name of thread in which this logging event was generated.
+     * log4php saves here the process id via {@link PHP_MANUAL#getmypid getmypid()}
+     * @var mixed
+     */
+    private $threadName;
+
+    /**
+    * The number of seconds elapsed from 1/1/1970 until logging event
+    * was created plus microseconds if available.
+    * @var float
+    */
+    public $timeStamp;
+
+    /**
+    * @var LocationInfo Location information for the caller.
+    */
+    private $locationInfo;
+
+    /**
+     * @var ThrowableInformation log4php internal representation of throwable
+     */
+    private $throwableInfo;
+
+    /**
+    * Instantiate a LoggingEvent from the supplied parameters.
+    *
+    * Except {@link $timeStamp} all the other fields of
+    * LoggingEvent are filled when actually needed.
+    *
+    * @param string $fqcn name of the caller class.
+    * @param mixed $logger The {@link Logger} category of this event or the logger name.
+    * @param Level $level The level of this event.
+    * @param mixed $message The message of this event.
+    * @param integer $timeStamp the timestamp of this logging event.
+    * @param Exception $throwable The throwable associated with logging event
+    */
+    public function __construct($fqcn, $logger, Level $level, $message, $timeStamp = null, $throwable = null)
+    {
+        $this->fqcn = $fqcn;
+        if ($logger instanceof Logger) {
+            $this->logger = $logger;
+            $this->categoryName = $logger->getName();
+        } else {
+            $this->categoryName = strval($logger);
+        }
+        $this->level = $level;
+        $this->message = $message;
+        if ($timeStamp !== null && is_numeric($timeStamp)) {
+            $this->timeStamp = $timeStamp;
+        } else {
+            $this->timeStamp = microtime(true);
+        }
+
+        if (isset($throwable) && $throwable instanceof \Exception) {
+            $this->throwableInfo = new ThrowableInformation($throwable);
+        }
+    }
+
+    /**
+     * Returns the full qualified classname.
+     * TODO: PHP does contain namespaces in 5.3. Those should be returned too,
+     */
+     public function getFullQualifiedClassname()
+     {
+         return $this->fqcn;
+     }
+
+    /**
+     * Set the location information for this logging event. The collected
+     * information is cached for future use.
+     *
+     * <p>This method uses {@link PHP_MANUAL#debug_backtrace debug_backtrace()} function (if exists)
+     * to collect informations about caller.</p>
+     * <p>It only recognize informations generated by {@link Logger} and its subclasses.</p>
+     * @return LocationInfo
+     */
+    public function getLocationInformation()
+    {
+        if ($this->locationInfo === null) {
+
+            $locationInfo = array();
+            $trace = debug_backtrace();
+            $prevHop = null;
+
+            // make a downsearch to identify the caller
+            $hop = array_pop($trace);
+            while ($hop !== null) {
+                if (isset($hop['class'])) {
+                    $className = $hop['class'];
+
+                    if ($className === "Apache\\Log4php\\Logger" ||
+                        $className === "Apache\\Log4php\\RootLogger") {
+                        $locationInfo['line'] = $hop['line'];
+                        $locationInfo['file'] = $hop['file'];
+                        break;
+                    }
+                }
+                $prevHop = $hop;
+                $hop = array_pop($trace);
+            }
+            $locationInfo['class'] = isset($prevHop['class']) ? $prevHop['class'] : 'main';
+            if(isset($prevHop['function']) and
+                $prevHop['function'] !== 'include' and
+                $prevHop['function'] !== 'include_once' and
+                $prevHop['function'] !== 'require' and
+                $prevHop['function'] !== 'require_once') {
+
+                $locationInfo['function'] = $prevHop['function'];
+            } else {
+                $locationInfo['function'] = 'main';
+            }
+
+            $this->locationInfo = new LocationInfo($locationInfo, $this->fqcn);
+        }
+
+        return $this->locationInfo;
+    }
+
+    /**
+     * Return the level of this event. Use this form instead of directly
+     * accessing the {@link $level} field.
+     * @return Level
+     */
+    public function getLevel()
+    {
+        return $this->level;
+    }
+
+    /**
+     * Returns the logger which created the event.
+     * @return Logger
+     */
+    public function getLogger()
+    {
+        return $this->logger;
+    }
+
+    /**
+     * Return the name of the logger. Use this form instead of directly
+     * accessing the {@link $categoryName} field.
+     * @return string
+     */
+    public function getLoggerName()
+    {
+        return $this->categoryName;
+    }
+
+    /**
+     * Return the message for this logging event.
+     * @return mixed
+     */
+    public function getMessage()
+    {
+        return $this->message;
+    }
+
+    /**
+     * This method returns the NDC for this event. It will return the
+     * correct content even if the event was generated in a different
+     * thread or even on a different machine. The {@link NDC::get()} method
+     * should <b>never</b> be called directly.
+     * @return string
+     */
+    public function getNDC()
+    {
+        if ($this->ndcLookupRequired) {
+            $this->ndcLookupRequired = false;
+            $this->ndc = NDC::get();
+        }
+
+        return $this->ndc;
+    }
+
+    /**
+     * Returns the the context corresponding to the <code>key</code>
+     * parameter.
+     * @return string
+     */
+    public function getMDC($key)
+    {
+        return MDC::get($key);
+    }
+
+    /**
+     * Returns the entire MDC context.
+     * @return array
+     */
+    public function getMDCMap()
+    {
+        return MDC::getMap();
+    }
+
+    /**
+     * Render message.
+     * @return string
+     */
+    public function getRenderedMessage()
+    {
+        if ($this->renderedMessage === null and $this->message !== null) {
+            if (is_string($this->message)) {
+                $this->renderedMessage = $this->message;
+            } else {
+                $rendererMap = Logger::getHierarchy()->getRendererMap();
+                $this->renderedMessage= $rendererMap->findAndRender($this->message);
+            }
+        }
+
+        return $this->renderedMessage;
+    }
+
+    /**
+     * Returns the time when the application started, as a UNIX timestamp
+     * with microseconds.
+     * @return float
+     */
+    public static function getStartTime()
+    {
+        if (!isset(self::$startTime)) {
+            self::$startTime = microtime(true);
+        }
+
+        return self::$startTime;
+    }
+
+    /**
+     * @return float
+     */
+    public function getTimeStamp()
+    {
+        return $this->timeStamp;
+    }
+
+    /**
+     * Returns the time in seconds passed from the beginning of execution to
+     * the time the event was constructed.
+     *
+     * @return float Seconds with microseconds in decimals.
+     */
+    public function getRelativeTime()
+    {
+        return $this->timeStamp - self::$startTime;
+    }
+
+    /**
+     * Returns the time in milliseconds passed from the beginning of execution
+     * to the time the event was constructed.
+     *
+     * @deprecated This method has been replaced by getRelativeTime which
+     * 		does not perform unneccesary multiplication and formatting.
+     *
+     * @return integer
+     */
+    public function getTime()
+    {
+        $eventTime = $this->getTimeStamp();
+        $eventStartTime = LoggingEvent::getStartTime();
+
+        return number_format(($eventTime - $eventStartTime) * 1000, 0, '', '');
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getThreadName()
+    {
+        if ($this->threadName === null) {
+            $this->threadName = (string) getmypid();
+        }
+
+        return $this->threadName;
+    }
+
+    /**
+     * @return mixed ThrowableInformation
+     */
+    public function getThrowableInformation()
+    {
+        return $this->throwableInfo;
+    }
+
+    /**
+     * Serialize this object
+     * @return string
+     */
+    public function toString()
+    {
+        serialize($this);
+    }
+
+    /**
+     * Avoid serialization of the {@link $logger} object
+     */
+    public function __sleep()
+    {
+        return array(
+            'fqcn',
+            'categoryName',
+            'level',
+            'ndc',
+            'ndcLookupRequired',
+            'message',
+            'renderedMessage',
+            'threadName',
+            'timeStamp',
+            'locationInfo',
+        );
+    }
 
 }
 

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/MDC.php
----------------------------------------------------------------------
diff --git a/src/MDC.php b/src/MDC.php
index 9f911c6..6e7f008 100644
--- a/src/MDC.php
+++ b/src/MDC.php
@@ -32,56 +32,61 @@ namespace Apache\Log4php;
  * @since 0.3
  *
  */
-class MDC {
+class MDC
+{
+    /** Holds the context map. */
+    private static $map = array();
 
-	/** Holds the context map. */
-	private static $map = array();
+    /**
+     * Stores a context value as identified with the key parameter into the
+     * context map.
+     *
+     * @param string $key   the key
+     * @param string $value the value
+     */
+    public static function put($key, $value)
+    {
+        self::$map[$key] = $value;
+    }
 
-	/**
-	 * Stores a context value as identified with the key parameter into the
-	 * context map.
-	 *
-	 * @param string $key the key
-	 * @param string $value the value
-	 */
-	public static function put($key, $value) {
-		self::$map[$key] = $value;
-	}
+    /**
+     * Returns the context value identified by the key parameter.
+     *
+     * @param  string $key The key.
+     * @return string The context or an empty string if no context found
+     * 	for given key.
+     */
+    public static function get($key)
+    {
+        return isset(self::$map[$key]) ? self::$map[$key] : '';
+    }
 
-	/**
-	 * Returns the context value identified by the key parameter.
-	 *
-	 * @param string $key The key.
-	 * @return string The context or an empty string if no context found
-	 * 	for given key.
-	 */
-	public static function get($key) {
-		return isset(self::$map[$key]) ? self::$map[$key] : '';
-	}
+    /**
+     * Returns the contex map as an array.
+     * @return array The MDC context map.
+     */
+    public static function getMap()
+    {
+        return self::$map;
+    }
 
-	/**
-	 * Returns the contex map as an array.
-	 * @return array The MDC context map.
-	 */
-	public static function getMap() {
-		return self::$map;
-	}
+    /**
+     * Removes the the context identified by the key parameter.
+     *
+     * Only affects user mappings, not $_ENV or $_SERVER.
+     *
+     * @param string $key The key to be removed.
+     */
+    public static function remove($key)
+    {
+        unset(self::$map[$key]);
+    }
 
-	/**
-	 * Removes the the context identified by the key parameter.
-	 *
-	 * Only affects user mappings, not $_ENV or $_SERVER.
-	 *
-	 * @param string $key The key to be removed.
-	 */
-	public static function remove($key) {
-		unset(self::$map[$key]);
-	}
-
-	/**
-	 * Clears the mapped diagnostic context.
-	 */
-	public static function clear() {
-		self::$map = array();
-	}
+    /**
+     * Clears the mapped diagnostic context.
+     */
+    public static function clear()
+    {
+        self::$map = array();
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/NDC.php
----------------------------------------------------------------------
diff --git a/src/NDC.php b/src/NDC.php
index b3de74a..c81c233 100644
--- a/src/NDC.php
+++ b/src/NDC.php
@@ -74,111 +74,119 @@ namespace Apache\Log4php;
  *
  * @since 0.3
  */
-class NDC {
+class NDC
+{
+    /** This is the repository of NDC stack */
+    private static $stack = array();
 
-	/** This is the repository of NDC stack */
-	private static $stack = array();
+    /**
+     * Clear any nested diagnostic information if any. This method is
+     * useful in cases where the same thread can be potentially used
+     * over and over in different unrelated contexts.
+     *
+     * <p>This method is equivalent to calling the {@link setMaxDepth()}
+     * method with a zero <var>maxDepth</var> argument.
+     */
+    public static function clear()
+    {
+        self::$stack = array();
+    }
 
-	/**
-	 * Clear any nested diagnostic information if any. This method is
-	 * useful in cases where the same thread can be potentially used
-	 * over and over in different unrelated contexts.
-	 *
-	 * <p>This method is equivalent to calling the {@link setMaxDepth()}
-	 * method with a zero <var>maxDepth</var> argument.
-	 */
-	public static function clear() {
-		self::$stack = array();
-	}
+    /**
+     * Never use this method directly, use the {@link LoggingEvent::getNDC()} method instead.
+     * @return array
+     */
+    public static function get()
+    {
+        return implode(' ', self::$stack);
+    }
 
-	/**
-	 * Never use this method directly, use the {@link LoggingEvent::getNDC()} method instead.
-	 * @return array
-	 */
-	public static function get() {
-		return implode(' ', self::$stack);
-	}
+    /**
+     * Get the current nesting depth of this diagnostic context.
+     *
+     * @see setMaxDepth()
+     * @return integer
+     */
+    public static function getDepth()
+    {
+        return count(self::$stack);
+    }
 
-	/**
-	 * Get the current nesting depth of this diagnostic context.
-	 *
-	 * @see setMaxDepth()
-	 * @return integer
-	 */
-	public static function getDepth() {
-		return count(self::$stack);
-	}
+    /**
+     * Clients should call this method before leaving a diagnostic
+     * context.
+     *
+     * <p>The returned value is the value that was pushed last. If no
+     * context is available, then the empty string "" is returned.</p>
+     *
+     * @return string The innermost diagnostic context.
+     */
+    public static function pop()
+    {
+        if (count(self::$stack) > 0) {
+            return array_pop(self::$stack);
+        } else {
+            return '';
+        }
+    }
 
-	/**
-	 * Clients should call this method before leaving a diagnostic
-	 * context.
-	 *
-	 * <p>The returned value is the value that was pushed last. If no
-	 * context is available, then the empty string "" is returned.</p>
-	 *
-	 * @return string The innermost diagnostic context.
-	 */
-	public static function pop() {
-		if(count(self::$stack) > 0) {
-			return array_pop(self::$stack);
-		} else {
-			return '';
-		}
-	}
+    /**
+     * Looks at the last diagnostic context at the top of this NDC
+     * without removing it.
+     *
+     * <p>The returned value is the value that was pushed last. If no
+     * context is available, then the empty string "" is returned.</p>
+     * @return string The innermost diagnostic context.
+     */
+    public static function peek()
+    {
+        if (count(self::$stack) > 0) {
+            return end(self::$stack);
+        } else {
+            return '';
+        }
+    }
 
-	/**
-	 * Looks at the last diagnostic context at the top of this NDC
-	 * without removing it.
-	 *
-	 * <p>The returned value is the value that was pushed last. If no
-	 * context is available, then the empty string "" is returned.</p>
-	 * @return string The innermost diagnostic context.
-	 */
-	public static function peek() {
-		if(count(self::$stack) > 0) {
-			return end(self::$stack);
-		} else {
-			return '';
-		}
-	}
+    /**
+     * Push new diagnostic context information for the current thread.
+     *
+     * <p>The contents of the <var>message</var> parameter is
+     * determined solely by the client.
+     *
+     * @param string $message The new diagnostic context information.
+     */
+    public static function push($message)
+    {
+        array_push(self::$stack, (string) $message);
+    }
 
-	/**
-	 * Push new diagnostic context information for the current thread.
-	 *
-	 * <p>The contents of the <var>message</var> parameter is
-	 * determined solely by the client.
-	 *
-	 * @param string $message The new diagnostic context information.
-	 */
-	public static function push($message) {
-		array_push(self::$stack, (string)$message);
-	}
+    /**
+     * Remove the diagnostic context for this thread.
+     */
+    public static function remove()
+    {
+        NDC::clear();
+    }
 
-	/**
-	 * Remove the diagnostic context for this thread.
-	 */
-	public static function remove() {
-		NDC::clear();
-	}
-
-	/**
-	 * Set maximum depth of this diagnostic context. If the current
-	 * depth is smaller or equal to <var>maxDepth</var>, then no
-	 * action is taken.
-	 *
-	 * <p>This method is a convenient alternative to multiple
-	 * {@link pop()} calls. Moreover, it is often the case that at
-	 * the end of complex call sequences, the depth of the NDC is
-	 * unpredictable. The {@link setMaxDepth()} method circumvents
-	 * this problem.
-	 *
-	 * @param integer $maxDepth
-	 * @see getDepth()
-	 */
-	public static function setMaxDepth($maxDepth) {
-		$maxDepth = (int)$maxDepth;
-		if(NDC::getDepth() > $maxDepth) {
-			self::$stack = array_slice(self::$stack, 0, $maxDepth);
-		}
-	}
+    /**
+     * Set maximum depth of this diagnostic context. If the current
+     * depth is smaller or equal to <var>maxDepth</var>, then no
+     * action is taken.
+     *
+     * <p>This method is a convenient alternative to multiple
+     * {@link pop()} calls. Moreover, it is often the case that at
+     * the end of complex call sequences, the depth of the NDC is
+     * unpredictable. The {@link setMaxDepth()} method circumvents
+     * this problem.
+     *
+     * @param integer $maxDepth
+     * @see getDepth()
+     */
+    public static function setMaxDepth($maxDepth)
+    {
+        $maxDepth = (int) $maxDepth;
+        if (NDC::getDepth() > $maxDepth) {
+            self::$stack = array_slice(self::$stack, 0, $maxDepth);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/AbstractConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/AbstractConverter.php b/src/Pattern/AbstractConverter.php
index dc13f4b..57c6dfc 100644
--- a/src/Pattern/AbstractConverter.php
+++ b/src/Pattern/AbstractConverter.php
@@ -30,101 +30,105 @@ use Apache\Log4php\LoggingEvent;
  * converting a logging event in a converter specific manner.</p>
  * @since 0.3
  */
-abstract class AbstractConverter {
-
-	/**
-	 * Next converter in the converter chain.
-	 * @var AbstractConverter
-	 */
-	public $next = null;
-
-	/**
-	 * Formatting information, parsed from pattern modifiers.
-	 * @var FormattingInfo
-	 */
-	protected $formattingInfo;
-
-	/**
-	 * Converter-specific formatting options.
-	 * @var array
-	 */
-	protected $option;
-
-	/**
-	 * Constructor
-	 * @param FormattingInfo $formattingInfo
-	 * @param array $option
-	 */
-	public function __construct(FormattingInfo $formattingInfo = null, $option = null) {
-		$this->formattingInfo = $formattingInfo;
-		$this->option = $option;
-		$this->activateOptions();
-	}
-
-	/**
-	 * Called in constructor. Converters which need to process the options
-	 * can override this method.
-	 */
-	public function activateOptions() { }
-
-	/**
-	 * Converts the logging event to the desired format. Derived pattern
-	 * converters must implement this method.
-	 *
-	 * @param LoggingEvent $event
-	 */
-	abstract public function convert(LoggingEvent $event);
-
-	/**
-	 * Converts the event and formats it according to setting in the
-	 * Formatting information object.
-	 *
-	 * @param string &$sbuf string buffer to write to
-	 * @param LoggingEvent $event Event to be formatted.
-	 */
-	public function format(&$sbuf, $event) {
-		$string = $this->convert($event);
-
-		if (!isset($this->formattingInfo)) {
-			$sbuf .= $string;
-			return;
-		}
-
-		$fi = $this->formattingInfo;
-
-		// Empty string
-		if($string === '' || is_null($string)) {
-			if($fi->min > 0) {
-				$sbuf .= str_repeat(' ', $fi->min);
-			}
-			return;
-		}
-
-		$len = strlen($string);
-
-		// Trim the string if needed
-		if($len > $fi->max) {
-			if ($fi->trimLeft) {
-				$sbuf .= substr($string, $len - $fi->max, $fi->max);
-			} else {
-				$sbuf .= substr($string , 0, $fi->max);
-			}
-		}
-
-		// Add padding if needed
-		else if($len < $fi->min) {
-			if($fi->padLeft) {
-				$sbuf .= str_repeat(' ', $fi->min - $len);
-				$sbuf .= $string;
-			} else {
-				$sbuf .= $string;
-				$sbuf .= str_repeat(' ', $fi->min - $len);
-			}
-		}
-
-		// No action needed
-		else {
-			$sbuf .= $string;
-		}
-	}
+abstract class AbstractConverter
+{
+    /**
+     * Next converter in the converter chain.
+     * @var AbstractConverter
+     */
+    public $next = null;
+
+    /**
+     * Formatting information, parsed from pattern modifiers.
+     * @var FormattingInfo
+     */
+    protected $formattingInfo;
+
+    /**
+     * Converter-specific formatting options.
+     * @var array
+     */
+    protected $option;
+
+    /**
+     * Constructor
+     * @param FormattingInfo $formattingInfo
+     * @param array          $option
+     */
+    public function __construct(FormattingInfo $formattingInfo = null, $option = null)
+    {
+        $this->formattingInfo = $formattingInfo;
+        $this->option = $option;
+        $this->activateOptions();
+    }
+
+    /**
+     * Called in constructor. Converters which need to process the options
+     * can override this method.
+     */
+    public function activateOptions() { }
+
+    /**
+     * Converts the logging event to the desired format. Derived pattern
+     * converters must implement this method.
+     *
+     * @param LoggingEvent $event
+     */
+    abstract public function convert(LoggingEvent $event);
+
+    /**
+     * Converts the event and formats it according to setting in the
+     * Formatting information object.
+     *
+     * @param string       &$sbuf string buffer to write to
+     * @param LoggingEvent $event Event to be formatted.
+     */
+    public function format(&$sbuf, $event)
+    {
+        $string = $this->convert($event);
+
+        if (!isset($this->formattingInfo)) {
+            $sbuf .= $string;
+
+            return;
+        }
+
+        $fi = $this->formattingInfo;
+
+        // Empty string
+        if ($string === '' || is_null($string)) {
+            if ($fi->min > 0) {
+                $sbuf .= str_repeat(' ', $fi->min);
+            }
+
+            return;
+        }
+
+        $len = strlen($string);
+
+        // Trim the string if needed
+        if ($len > $fi->max) {
+            if ($fi->trimLeft) {
+                $sbuf .= substr($string, $len - $fi->max, $fi->max);
+            } else {
+                $sbuf .= substr($string , 0, $fi->max);
+            }
+        }
+
+        // Add padding if needed
+        else if ($len < $fi->min) {
+            if ($fi->padLeft) {
+                $sbuf .= str_repeat(' ', $fi->min - $len);
+                $sbuf .= $string;
+            } else {
+                $sbuf .= $string;
+                $sbuf .= str_repeat(' ', $fi->min - $len);
+            }
+        }
+
+        // No action needed
+        else {
+            $sbuf .= $string;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/ClassConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/ClassConverter.php b/src/Pattern/ClassConverter.php
index b5e658c..09b87da 100644
--- a/src/Pattern/ClassConverter.php
+++ b/src/Pattern/ClassConverter.php
@@ -26,37 +26,39 @@ use Apache\Log4php\LoggingEvent;
  * request was issued.
  * @since 2.3
  */
-class ClassConverter extends AbstractConverter {
+class ClassConverter extends AbstractConverter
+{
+    /** Length to which to shorten the class name. */
+    private $length;
 
-	/** Length to which to shorten the class name. */
-	private $length;
+    /** Holds processed class names. */
+    private $cache = array();
 
-	/** Holds processed class names. */
-	private $cache = array();
+    public function activateOptions()
+    {
+        // Parse the option (desired output length)
+        if (isset($this->option) && is_numeric($this->option) && $this->option >= 0) {
+            $this->length = (integer) $this->option;
+        }
+    }
 
-	public function activateOptions() {
-		// Parse the option (desired output length)
-		if (isset($this->option) && is_numeric($this->option) && $this->option >= 0) {
-			$this->length = (integer) $this->option;
-		}
-	}
+    public function convert(LoggingEvent $event)
+    {
+        $name = $event->getLocationInformation()->getClassName();
 
-	public function convert(LoggingEvent $event) {
-		$name = $event->getLocationInformation()->getClassName();
+        if (!isset($this->cache[$name])) {
 
-		if (!isset($this->cache[$name])) {
+            // If length is set return shortened class name
+            if (isset($this->length)) {
+                $this->cache[$name] = Utils::shortenClassName($name, $this->length);
+            }
 
-			// If length is set return shortened class name
-			if (isset($this->length)) {
-				$this->cache[$name] = Utils::shortenClassName($name, $this->length);
-			}
+            // If no length is specified return the full class name
+            else {
+                $this->cache[$name] = $name;
+            }
+        }
 
-			// If no length is specified return the full class name
-			else {
-				$this->cache[$name] = $name;
-			}
-		}
-
-		return $this->cache[$name];
-	}
+        return $this->cache[$name];
+    }
 }

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/35dfd5d3/src/Pattern/CookieConverter.php
----------------------------------------------------------------------
diff --git a/src/Pattern/CookieConverter.php b/src/Pattern/CookieConverter.php
index 69b5738..245c11d 100644
--- a/src/Pattern/CookieConverter.php
+++ b/src/Pattern/CookieConverter.php
@@ -27,6 +27,7 @@ namespace Apache\Log4php\Pattern;
  *
  * @since 2.3
  */
-class CookieConverter extends SuperglobalConverter {
-	protected $name = '_COOKIE';
-}
\ No newline at end of file
+class CookieConverter extends SuperglobalConverter
+{
+    protected $name = '_COOKIE';
+}


Mime
View raw message