Add LOG_WARNING() debug log macro

This commit is contained in:
Chase Bradley 2025-08-17 22:51:13 -04:00
parent b671458f81
commit 11b54313c5
3 changed files with 8 additions and 3 deletions

View file

@ -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},

View file

@ -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;

View file

@ -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); }