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
@@ -6,7 +6,7 @@
  * @copyright Copyright (c) 2010 Christopher Han
  * @package GitPHP
  */
-class GitPHP_DebugLog
+class GitPHP_DebugLog implements GitPHP_Observer_Interface
 {
 	/**
 	 * Stores the singleton instance
@@ -209,5 +209,28 @@
 		return $data;
 	}
 
+	/**
+	 * Notify that observable object changed
+	 *
+	 * @param GitPHP_Observable_Interface $object object
+	 * @param int $changeType type of change
+	 * @param array $args argument array
+	 */
+	public function ObjectChanged($object, $changeType, $args = array())
+	{
+		if ($changeType !== GitPHP_Observer_Interface::LoggableChange)
+			return;
+
+		if (!$this->enabled)
+			return;
+
+		if (!isset($args[0]) || empty($args[0]))
+			return;
+
+		$msg = $args[0];
+
+		$this->Log($msg);
+	}
+
 }
 

comments