Attach logger to projectlist as observer
[gitphp.git] / include / DebugLog.class.php
blob:a/include/DebugLog.class.php -> blob:b/include/DebugLog.class.php
--- a/include/DebugLog.class.php
+++ b/include/DebugLog.class.php
@@ -9,13 +9,6 @@
 class GitPHP_DebugLog implements GitPHP_Observer_Interface
 {
 	/**
-	 * Stores the singleton instance
-	 *
-	 * @var GitPHP_DebugLog
-	 */
-	protected static $instance;
-
-	/**
 	 * Stores whether logging is enabled
 	 *
 	 * @var boolean
@@ -49,29 +42,6 @@
 	 * @var string[]
 	 */
 	protected $entries = array();
-
-	/**
-	 * Returns the singleton instance
-	 *
-	 * @return GitPHP_DebugLog instance of logging class
-	 */
-	public static function GetInstance()
-	{
-		if (!self::$instance) {
-			$config = GitPHP_Config::GetInstance();
-			self::$instance = new GitPHP_DebugLog($config->GetValue('debug', false), $config->GetValue('benchmark', false));
-		}
-
-		return self::$instance;
-	}
-
-	/**
-	 * Releases the singleton instance
-	 */
-	public static function DestroyInstance()
-	{
-		self::$instance = null;
-	}
 
 	/**
 	 * Constructor
@@ -79,7 +49,7 @@
 	 * @param boolean $enabled whether log should be enabled
 	 * @param boolean $benchmark whether benchmarking should be enabled
 	 */
-	private function __construct($enabled = false, $benchmark = false)
+	public function __construct($enabled = false, $benchmark = false)
 	{
 		$this->startTime = microtime(true);
 		$this->startMem = memory_get_usage();
@@ -210,6 +180,14 @@
 	}
 
 	/**
+	 * Clears the log
+	 */
+	public function Clear()
+	{
+		$this->entries = array();
+	}
+
+	/**
 	 * Notify that observable object changed
 	 *
 	 * @param GitPHP_Observable_Interface $object object

comments