From 3d1e05e5015a0872a2a72fb71cbb0da152e01c8c Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Sun, 16 May 2021 16:09:29 -0700
Subject: [PATCH] Log the current Git branch and hash along with every error

This eliminates any ambiguity about what exact version was in use when each error is logged.
---
 src/sbbs3/logfile.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/sbbs3/logfile.cpp b/src/sbbs3/logfile.cpp
index 4c8aee93b4..642f72663d 100644
--- a/src/sbbs3/logfile.cpp
+++ b/src/sbbs3/logfile.cpp
@@ -20,6 +20,8 @@
  ****************************************************************************/
 
 #include "sbbs.h"
+#include "git_branch.h"
+#include "git_hash.h"
 
 const char* log_line_ending = "\r\n";
 
@@ -113,8 +115,10 @@ extern "C" int errorlog(scfg_t* cfg, int level, const char* host, const char* te
 	SAFEPRINTF(path, "%serror.log", cfg->logs_dir);
 	if((fp = fnopen(NULL,path,O_WRONLY|O_CREAT|O_APPEND))==NULL)
 		return -1; 
-	fprintf(fp,"%.24s %s%s%s%s%s"
+	fprintf(fp,"%.24s %s/%s %s%s%s%s%s"
 		,ctime_r(&now, buf)
+		,GIT_BRANCH
+		,GIT_HASH
 		,host==NULL ? "":host
 		,log_line_ending
 		,text
-- 
GitLab