allegro5 icon indicating copy to clipboard operation
allegro5 copied to clipboard

Add a way to disable (and/or disable by default) Allegro logging to stdout under debugging on Windows.

Open SiegeLord opened this issue 11 months ago • 5 comments

SiegeLord avatar Mar 24 '24 19:03 SiegeLord

(from discord...) https://github.com/liballeg/allegro5/blob/master/src/debug.c#L324 So we always OutputDebugString on windows, write to stderr on iOS, __android_log_print on android, and write to trace_info.trace_file if that is specified?

pedro-w avatar Mar 25 '24 06:03 pedro-w

The Windows is a standout, since the mobile platforms don't have a way to output a log file. Windows writes both to debug window and file by default. I kept thinking about this today, and I'm inclined to disable OutputDebugString by default.

SiegeLord avatar Mar 25 '24 08:03 SiegeLord

One possibility is to add a nativelog=0 / nativelog=1 option to allegro5.cfg with the default being 1 for the mobile platforms and 0 for the desktop platforms? Is part of the problem that the default logging spews out too much info - i.e should the default level be INFO and not DEBUG? (actually it's 999 in DEBUGMODE which is a bit like the Spinal Tap "turn up to 11"!)

pedro-w avatar Mar 25 '24 08:03 pedro-w

One possibility is to add a nativelog=0 / nativelog=1 option to allegro5.cfg with the default being 1 for the mobile platforms and 0 for the desktop platforms?

Not a bad idea!

Is part of the problem that the default logging spews out too much info - i.e should the default level be INFO and not DEBUG? (actually it's 999 in DEBUGMODE which is a bit like the Spinal Tap "turn up to 11"!)

Yeah, we talked about this on discord. One suggestion I had was to add another level under debug (VERBOSE or something) and move the spammy logs to it instead.

SiegeLord avatar Mar 26 '24 02:03 SiegeLord

actually it's 999 in DEBUGMODE

Whoops - wrong way round - the levels are DEBUG=0 up to ERROR=3 and 999 is set in release mode for "output nothing"

I can't see any consistent pattern in the Allegro source for what has been assigned to ALLEGRO_DEBUG vs ALLEGRO_INFO - as you say the best thing might be to add extra verbose level, leave most alone and just move the spammiest ones. traceinfo.level is a signed int so the new level could be -1 I think, would need to check. Then the default level in DEBUGMODE being 0 would automatically omit those verbose logs.

pedro-w avatar Mar 26 '24 06:03 pedro-w