From: Holger Schemel Date: Thu, 17 Sep 2020 18:10:16 +0000 (+0200) Subject: moved checks for debug mode to main logging function X-Git-Tag: 4.2.0.3~27 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=6948b28f2469407be9f8439c7d7f74a40038636f;p=rocksndiamonds.git moved checks for debug mode to main logging function --- diff --git a/src/libgame/misc.c b/src/libgame/misc.c index c5067fb9..7b9beacc 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -293,6 +293,17 @@ static void Log(int log_level, char *mode, char *format, va_list ap) if (log_level < 0 || log_level > LOG_FATAL) return; + if (log_level == LOG_DEBUG) + { + if (!options.debug) + return; + + // if optional debug mode specified, limit debug output accordingly + if (options.debug_mode != NULL && + !strEqual(options.debug_mode, mode)) + return; + } + #if defined(PLATFORM_ANDROID) android_log_prio = (log_level == LOG_DEBUG ? ANDROID_LOG_DEBUG : log_level == LOG_INFO ? ANDROID_LOG_INFO : @@ -340,14 +351,6 @@ void Debug(char *mode, char *format, ...) { va_list ap; - if (!options.debug) - return; - - // if optional debug mode specified, limit debug output accordingly - if (options.debug_mode != NULL && - !strEqual(options.debug_mode, mode)) - return; - va_start(ap, format); Log(LOG_DEBUG, mode, format, ap); va_end(ap);