added more debugging for error conditions

This commit is contained in:
Mark Vejvoda
2010-05-01 10:46:56 +00:00
parent 77fccb8c4c
commit 2417f37e21
8 changed files with 62 additions and 15 deletions

View File

@@ -47,8 +47,6 @@
#include <algorithm>
#include <map>
#include "leak_dumper.h"
using namespace Shared::Platform;

View File

@@ -84,7 +84,7 @@ void SystemFlags::Close() {
currentDebugLog.fileStream->close();
}
delete currentDebugLog.fileStream;
delete currentDebugLog.mutex;
//delete currentDebugLog.mutex;
}
currentDebugLog.fileStream = NULL;
currentDebugLog.fileStreamOwner = false;
@@ -143,7 +143,7 @@ void SystemFlags::OutputDebug(DebugType type, const char *fmt, ...) {
currentDebugLog2.fileStream != NULL) {
currentDebugLog.fileStream = currentDebugLog2.fileStream;
currentDebugLog.fileStreamOwner = false;
currentDebugLog.mutex = currentDebugLog2.mutex;
//currentDebugLog.mutex = currentDebugLog2.mutex;
break;
}
}
@@ -189,17 +189,17 @@ void SystemFlags::OutputDebug(DebugType type, const char *fmt, ...) {
currentDebugLog.fileStream = new std::ofstream();
currentDebugLog.fileStream->open(debugLog.c_str(), ios_base::out | ios_base::trunc);
currentDebugLog.fileStreamOwner = true;
currentDebugLog.mutex = new Mutex();
//currentDebugLog.mutex = new Mutex();
}
printf("Opening logfile [%s] type = %d, currentDebugLog.fileStreamOwner = %d\n",debugLog.c_str(),type, currentDebugLog.fileStreamOwner);
currentDebugLog.mutex->p();
//currentDebugLog.mutex->p();
(*currentDebugLog.fileStream) << "Starting Mega-Glest logging for type: " << type << "\n";
(*currentDebugLog.fileStream).flush();
currentDebugLog.mutex->v();
//currentDebugLog.mutex->v();
}
//printf("Logfile is open [%s]\n",SystemFlags::debugLogFile);
@@ -208,12 +208,12 @@ void SystemFlags::OutputDebug(DebugType type, const char *fmt, ...) {
assert(currentDebugLog.fileStream != NULL);
currentDebugLog.mutex->p();
//currentDebugLog.mutex->p();
(*currentDebugLog.fileStream) << "[" << szBuf2 << "] " << szBuf;
(*currentDebugLog.fileStream).flush();
currentDebugLog.mutex->v();
//currentDebugLog.mutex->v();
}
// output to console
else {