Remove the ability to output debug log to a file

Before this, debug logs with level 5 and above were written to
`./xsystem35.log`. Now all logs are written to stderr.
This commit is contained in:
kichikuou
2021-10-31 21:53:38 +09:00
parent bc06099e01
commit 828cb047ba
3 changed files with 6 additions and 46 deletions
+2
View File
@@ -88,9 +88,11 @@ static inline int sl_getc(void) { return sl_sco[sl_index++]; }
sys_message(2, "%d,%x: " fmt, sl_getPage(), sl_getIndex(), ##__VA_ARGS__)
#define DEBUG_COMMAND(fmt, ...) \
sys_message(5, "%d,%x: " fmt, sl_getPage(), sl_getIndex(), ##__VA_ARGS__)
#define DEBUG_MESSAGE(...) sys_message(6, __VA_ARGS__)
#else
#define DEBUG_COMMAND(...)
#define DEBUG_COMMAND_YET(...)
#define DEBUG_MESSAGE(...)
#endif
#endif /* !__SCENARIO_ */
+4 -25
View File
@@ -86,7 +86,6 @@ static void sys35_ParseOption(int *argc, char **argv);
static void check_profile();
/* for debugging */
static FILE *fpdebuglog;
static int debuglv = DEBUGLEVEL;
enum {
DEBUGGER_DISABLED,
@@ -143,11 +142,10 @@ static void sys35_usage(boolean verbose) {
#ifdef DEBUG
puts(" -debuglv # : debug level");
puts(" : 0: critical error message only ");
puts(" : 1: + waring message");
puts(" : 2: + not implemented command message");
puts(" : 5: + implemented command (write to logfile)");
puts(" : 6: + message (write to logfile)");
puts(" : 1: warings");
puts(" : 2: unimplemented commands");
puts(" : 5: command trace");
puts(" : 6: message trace");
#endif
puts(" -noantialias : never use antialiased string");
puts(" -fullscreen : start with fullscreen");
@@ -177,13 +175,6 @@ void sys_message(int lv, char *format, ...) {
};
int prio = prio_table[min(lv, 5)];
__android_log_vprint(prio, "xsystem35", format, args);
#elif defined (DEBUG)
if (lv >= 5) {
vfprintf(fpdebuglog, format, args);
fflush(fpdebuglog);
} else {
vfprintf(stderr, format, args);
}
#else
vfprintf(stderr, format, args);
#endif
@@ -255,11 +246,6 @@ static void sys35_remove() {
#ifdef ENABLE_GTK
s39ini_remove();
#endif
#if DEBUG
if (debuglv >= 3) {
fclose(fpdebuglog);
}
#endif
}
void sys_reset() {
@@ -495,13 +481,6 @@ int main(int argc, char **argv) {
check_profile();
sys35_ParseOption(&argc, argv);
#if DEBUG
if (debuglv >= 5) {
if (NULL == (fpdebuglog = fopen(DEBUGLOGFILE, "w"))) {
fpdebuglog = stderr;
}
}
#endif
if (!initGameResource(&nact->files, gameResourceFile)) {
#ifdef _WIN32
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "xsystem35", "Cannot find scenario file (*SA.ALD)", NULL);
-21
View File
@@ -31,27 +31,6 @@
#include "variable.h"
#include "ald_manager.h"
/* logfile when debug level >= 5 */
#define DEBUGLOGFILE "./xsystem35.log"
/*
debug level in xsystem35
0: critical error message only (output to terminal or message box)
1: warning only(output to terminal) [stable release default]
2: add not inplement message (output to terminal) [devel relase default]
5: add command message (output to terminal or FILE)
6: add message(output to terminal or FILE)
*/
#ifdef DEBUG
#define DEBUG_MESSAGE(...) sys_message(6, __VA_ARGS__)
#else
#define DEBUG_MESSAGE(...)
#endif
#define System_idle(msec) usleep(1000l * (msec));
// extern void System_idle(int msec);
/* system35 画面デフォルト */
#define SYS35_DEFAULT_WIDTH 640
#define SYS35_DEFAULT_HEIGHT 480