Log desync debug output to the console as well as the file.
Be fault tolerant if the desync and/or random file cannot be created, and write to the console.
This commit is contained in:
@@ -122,19 +122,21 @@ static void debug_print(const char *dbg, const char *buf)
|
||||
#endif /* ENABLE_NETWORK */
|
||||
if (strcmp(dbg, "desync") == 0) {
|
||||
static FILE *f = FioFOpenFile("commands-out.log", "wb", AUTOSAVE_DIR);
|
||||
if (f == NULL) return;
|
||||
|
||||
if (f != NULL) {
|
||||
fprintf(f, "%s%s\n", GetLogPrefix(), buf);
|
||||
fflush(f);
|
||||
}
|
||||
#ifdef RANDOM_DEBUG
|
||||
} else if (strcmp(dbg, "random") == 0) {
|
||||
static FILE *f = FioFOpenFile("random-out.log", "wb", AUTOSAVE_DIR);
|
||||
if (f == NULL) return;
|
||||
|
||||
if (f != NULL) {
|
||||
fprintf(f, "%s\n", buf);
|
||||
fflush(f);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
}
|
||||
|
||||
char buffer[512];
|
||||
seprintf(buffer, lastof(buffer), "%sdbg: [%s] %s\n", GetLogPrefix(), dbg, buf);
|
||||
#if defined(WINCE)
|
||||
@@ -149,7 +151,6 @@ static void debug_print(const char *dbg, const char *buf)
|
||||
#endif /* ENABLE_NETWORK */
|
||||
IConsoleDebug(dbg, buf);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output a debug line.
|
||||
|
Reference in New Issue
Block a user