add a check for debug logging, to only log when the environment variable DEBUG is set to 1

This commit is contained in:
2025-09-15 13:36:42 +02:00
parent 023123e54f
commit 25fa078c98

View File

@@ -14,6 +14,12 @@ static void error_log(FILE *restrict stream, const char *restrict pfx, uint ln,
}
void error_debug(uint ln, const char *restrict file, const char *restrict fmt, ...) {
#ifndef NDEBUG
#else
char *env = getenv("DEBUG");
if (env && env[0] != '1')
return;
#endif
va_list ap;
va_start(ap, fmt);
error_log(stdout, "\033[95mDBG\033[0m", ln, file, fmt, ap);