[Box Backup-commit] COMMIT r1297 - box/chris/general/bin/bbackupd

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Wed, 21 Feb 2007 00:16:13 +0000


Author: chris
Date: 2007-02-21 00:16:13 +0000 (Wed, 21 Feb 2007)
New Revision: 1297

Modified:
   box/chris/general/bin/bbackupd/BackupDaemon.cpp
Log:
Port remaining win32 parts to new logging framework

Remove dependency on syslog.h


Modified: box/chris/general/bin/bbackupd/BackupDaemon.cpp
===================================================================
--- box/chris/general/bin/bbackupd/BackupDaemon.cpp	2007-02-21 00:12:02 UTC (rev 1296)
+++ box/chris/general/bin/bbackupd/BackupDaemon.cpp	2007-02-21 00:16:13 UTC (rev 1297)
@@ -18,9 +18,6 @@
 #ifdef HAVE_SIGNAL_H
 	#include <signal.h>
 #endif
-#ifdef HAVE_SYSLOG_H
-	#include <syslog.h>
-#endif
 #ifdef HAVE_SYS_PARAM_H
 	#include <sys/param.h>
 #endif
@@ -132,7 +129,7 @@
 	mhMessageToSendEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
 	if(mhMessageToSendEvent == INVALID_HANDLE_VALUE)
 	{
-		syslog(LOG_ERR, "Failed to create event object: error %d",
+		BOX_ERROR("Failed to create event object: error " <<
 			GetLastError);
 		exit(1);
 	}
@@ -142,7 +139,7 @@
 	mhCommandReceivedEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
 	if(mhCommandReceivedEvent == INVALID_HANDLE_VALUE)
 	{
-		syslog(LOG_ERR, "Failed to create event object: error %d",
+		BOX_ERROR("Failed to create event object: error " <<
 			GetLastError);
 		exit(1);
 	}
@@ -396,17 +393,18 @@
 				}
 				else if(result != 1)
 				{
-					::syslog(LOG_ERR, "WaitForMultipleObjects returned invalid result %d", result);
+					BOX_ERROR("WaitForMultipleObjects returned invalid result " << result);
 					continue;
 				}
 
 				if(!readLine.GetLine(command))
 				{
-					::syslog(LOG_ERR, "Failed to read line");
+					BOX_ERROR("Failed to read line");
 					continue;
 				}
 
-				printf("Received command '%s' from client\n", command.c_str());
+				BOX_INFO("Received command " << command << 
+					" from client");
 
 				bool sendOK = false;
 				bool sendResponse = true;
@@ -1092,8 +1090,8 @@
 	}
 	else
 	{
-		::syslog(LOG_ERR, "Unexpected result from "
-			"WaitForSingleObject: error %d", GetLastError());
+		BOX_ERROR("Unexpected result from WaitForSingleObject: "
+			"error " << GetLastError());
 	}
 
 	return;