From 11b54313c511c9e8646267124a26238f2be99752 Mon Sep 17 00:00:00 2001 From: Chase Bradley Date: Sun, 17 Aug 2025 22:51:13 -0400 Subject: [PATCH] Add LOG_WARNING() debug log macro --- src/pc/configfile.c | 2 ++ src/pc/configfile.h | 1 + src/pc/debuglog.h | 8 +++++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pc/configfile.c b/src/pc/configfile.c index f2267a7db..9036ec53b 100644 --- a/src/pc/configfile.c +++ b/src/pc/configfile.c @@ -158,6 +158,7 @@ bool configCameraToxicGas = true; bool configLuaProfiler = false; bool configDebugPrint = false; bool configDebugInfo = false; +bool configDebugWarning = false; bool configDebugError = false; #ifdef DEVELOPMENT bool configCtxProfiler = false; @@ -310,6 +311,7 @@ static const struct ConfigOption options[] = { {.name = "lua_profiler", .type = CONFIG_TYPE_BOOL, .boolValue = &configLuaProfiler}, {.name = "debug_print", .type = CONFIG_TYPE_BOOL, .boolValue = &configDebugPrint}, {.name = "debug_info", .type = CONFIG_TYPE_BOOL, .boolValue = &configDebugInfo}, + {.name = "debug_warning", .type = CONFIG_TYPE_BOOL, .boolValue = &configDebugWarning}, {.name = "debug_error", .type = CONFIG_TYPE_BOOL, .boolValue = &configDebugError}, #ifdef DEVELOPMENT {.name = "ctx_profiler", .type = CONFIG_TYPE_BOOL, .boolValue = &configCtxProfiler}, diff --git a/src/pc/configfile.h b/src/pc/configfile.h index d537970e4..06c9b34ae 100644 --- a/src/pc/configfile.h +++ b/src/pc/configfile.h @@ -123,6 +123,7 @@ extern bool configCameraToxicGas; extern bool configLuaProfiler; extern bool configDebugPrint; extern bool configDebugInfo; +extern bool configDebugWarning; extern bool configDebugError; #ifdef DEVELOPMENT extern bool configCtxProfiler; diff --git a/src/pc/debuglog.h b/src/pc/debuglog.h index 04e238c14..1f46abcff 100644 --- a/src/pc/debuglog.h +++ b/src/pc/debuglog.h @@ -46,11 +46,13 @@ static void _debuglog_print_log(const char* logType, char* filename) { #if defined(DISABLE_MODULE_LOG) #define LOG_DEBUG(...) #define LOG_INFO(...) +#define LOG_WARNING(...) #define LOG_ERROR(...) #else -#define LOG_DEBUG(...) (configDebugPrint ? ( _debuglog_print_log("DEBUG", __FILE__), printf(__VA_ARGS__), printf("\n") ) : 0) -#define LOG_INFO(...) ((configDebugInfo || gCLIOpts.headless) ? ( _debuglog_print_log("INFO", __FILE__), printf(__VA_ARGS__), printf("\n") ) : 0) -#define LOG_ERROR(...) (configDebugError ? ( _debuglog_print_log("ERROR", __FILE__), printf(__VA_ARGS__), printf("\n") ) : 0) +#define LOG_DEBUG(...) (configDebugPrint ? ( _debuglog_print_log("DEBUG", __FILE__), printf(__VA_ARGS__), printf("\n") ) : 0) +#define LOG_INFO(...) ((configDebugInfo || gCLIOpts.headless) ? ( _debuglog_print_log("INFO", __FILE__), printf(__VA_ARGS__), printf("\n") ) : 0) +#define LOG_WARNING(...) (configDebugWarning ? ( _debuglog_print_log("WARNING", __FILE__), printf(__VA_ARGS__), printf("\n") ) : 0) +#define LOG_ERROR(...) (configDebugError ? ( _debuglog_print_log("ERROR", __FILE__), printf(__VA_ARGS__), printf("\n") ) : 0) #endif #define LOG_CONSOLE(...) { snprintf(gDjuiConsoleTmpBuffer, CONSOLE_MAX_TMP_BUFFER, __VA_ARGS__), djui_console_message_create(gDjuiConsoleTmpBuffer, CONSOLE_MESSAGE_INFO); }