Fix other debug log messages to fit better with key/value display
Fix other debug log messages to fit better with key/value display

--- a/include/DebugLog.class.php
+++ b/include/DebugLog.class.php
@@ -236,8 +236,8 @@
 			return;
 
 		$msg = $args[0];
-		$msg_data = isset($args[1]) ? $args[1] : '';
-		$type = isset($args[2]) ? $args[2] : 'ts';
+		$msg_data = !empty($args[1]) ? $args[1] : '';
+		$type = !empty($args[2]) ? $args[2] : 'ts';
 
 		$this->Log($msg, $msg_data, $type);
 	}

--- a/include/controller/ControllerBase.class.php
+++ b/include/controller/ControllerBase.class.php
@@ -651,7 +651,7 @@
 		$this->tpl->clearAllAssign();
 
 		if ($this->projectList)
-			$log->Log('MemoryCache count: ' . $this->projectList->GetMemoryCache()->GetCount());
+			$log->Log('MemoryCache', 'Count: ' . $this->projectList->GetMemoryCache()->GetCount());
 
 		if ($log->GetEnabled()) {
 			$this->tpl->assign('debuglog', $log);

--- a/include/git/projectlist/ProjectListArray.class.php
+++ b/include/git/projectlist/ProjectListArray.class.php
@@ -60,7 +60,7 @@
 					}
 				}
 			} catch (Exception $e) {
-				$this->Log($e->getMessage());
+				$this->Log('Project error', $e->getMessage());
 			}
 		}
 	}

--- a/include/git/projectlist/ProjectListArrayLegacy.class.php
+++ b/include/git/projectlist/ProjectListArrayLegacy.class.php
@@ -49,7 +49,7 @@
 							unset($projObj);
 						}
 					} catch (Exception $e) {
-						$this->Log($e->getMessage());
+						$this->Log('Project error', $e->getMessage());
 					}
 				}
 			}

--- a/include/git/projectlist/ProjectListBase.class.php
+++ b/include/git/projectlist/ProjectListBase.class.php
@@ -708,13 +708,13 @@
 	 *
 	 * @param string $message message
 	 */
-	protected function Log($message)
+	protected function Log($message, $messagedata = null)
 	{
 		if (empty($message))
 			return;
 
 		foreach ($this->observers as $observer) {
-			$observer->ObjectChanged($this, GitPHP_Observer_Interface::LoggableChange, array($message));
+			$observer->ObjectChanged($this, GitPHP_Observer_Interface::LoggableChange, array($message, $messagedata));
 		}
 	}
 

--- a/include/git/projectlist/ProjectListDirectory.class.php
+++ b/include/git/projectlist/ProjectListDirectory.class.php
@@ -59,7 +59,7 @@
 		if (!(is_dir($dir) && is_readable($dir)))
 			return;
 
-		$this->Log(sprintf('Searching directory %1$s', $dir));
+		$this->Log('Search directory', $dir);
 
 		if ($dh = opendir($dir)) {
 			$trimlen = strlen(GitPHP_Util::AddSlash($this->projectRoot)) + 1;
@@ -67,7 +67,7 @@
 				$fullPath = $dir . '/' . $file;
 				if ((strpos($file, '.') !== 0) && is_dir($fullPath)) {
 					if (is_file($fullPath . '/HEAD')) {
-						$this->Log(sprintf('Found project %1$s', $fullPath));
+						$this->Log('Found project', $fullPath);
 						$projectPath = substr($fullPath, $trimlen);
 						if (!isset($this->projects[$projectPath])) {
 							$project = $this->LoadProject($projectPath);
@@ -80,7 +80,7 @@
 						$this->RecurseDir($fullPath);
 					}
 				} else {
-					$this->Log(sprintf('Skipping %1$s', $fullPath));
+					$this->Log('Skip', $fullPath);
 				}
 			}
 			closedir($dh);
@@ -105,7 +105,7 @@
 			}
 
 			if ($this->exportedOnly && !$project->GetDaemonEnabled()) {
-				$this->Log(sprintf('Project %1$s not enabled for export', $project->GetPath()));
+				$this->Log('Project export disabled', $project->GetPath());
 				return null;
 			}
 
@@ -122,7 +122,7 @@
 			return $project;
 
 		} catch (Exception $e) {
-			$this->Log($e->getMessage());
+			$this->Log('Project error', $e->getMessage());
 		}
 
 		return null;

--- a/include/git/projectlist/ProjectListFile.class.php
+++ b/include/git/projectlist/ProjectListFile.class.php
@@ -83,7 +83,7 @@
 						$owner = $lineData['owner'];
 					}
 				} else {
-					$this->Log(sprintf('%1$s is not a git project', $projectRoot . $proj));
+					$this->Log('Invalid project', $projectRoot . $proj);
 				}
 				break;
 			}

--- a/include/git/projectlist/ProjectListScmManager.class.php
+++ b/include/git/projectlist/ProjectListScmManager.class.php
@@ -84,17 +84,17 @@
 			return null;
 
 		if (!(isset($data['type']) && ($data['type'] == 'git'))) {
-			$this->Log(sprintf('%1$s is not a git project', $proj));
+			$this->Log('Invalid project', $proj);
 			return null;
 		}
 
 		if (!(isset($data['public']) && ($data['public'] == true))) {
-			$this->Log(sprintf('%1$s is not public', $proj));
+			$this->Log('Private project', $proj);
 			return null;
 		}
 
 		if (!is_file(GitPHP_Util::AddSlash($this->projectRoot) . $proj . '/HEAD')) {
-			$this->Log(sprintf('%1$s is not a git project', $proj));
+			$this->Log('Invalid project', $proj);
 		}
 
 		$projectObj = new GitPHP_Project($this->projectRoot, $proj);

comments