- when we have a runtime error, we now log the error text to error.log which will be located in the path where all log files are written.

This commit is contained in:
Mark Vejvoda 2011-10-03 18:39:21 +00:00
parent 9316c1b4c3
commit be3209e1fc
1 changed files with 13 additions and 5 deletions

View File

@ -334,9 +334,7 @@ public:
}
#endif
static void handleRuntimeError(const char *msg) {
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
static void logError(const char *msg, bool confirmToConsole) {
string errorLogFile = "error.log";
if(getGameReadWritePath(GameConstants::path_logs_CacheLookupKey) != "") {
errorLogFile = getGameReadWritePath(GameConstants::path_logs_CacheLookupKey) + errorLogFile;
@ -372,9 +370,17 @@ public:
fclose(fp);
}
#endif
printf("Error saved to logfile [%s]\n",errorLogFile.c_str());
fflush(stdout);
if(confirmToConsole == true) {
printf("Error saved to logfile [%s]\n",errorLogFile.c_str());
fflush(stdout);
}
}
}
static void handleRuntimeError(const char *msg) {
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
logError(msg,true);
Program *program = Program::getInstance();
@ -470,6 +476,8 @@ public:
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
logError(errMsg.c_str(),false);
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] [%s]\n",__FILE__,__FUNCTION__,__LINE__,errMsg.c_str());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] [%s]\n",__FILE__,__FUNCTION__,__LINE__,errMsg.c_str());