mirror of
https://github.com/thepigeongenerator/mcaselector-lite.git
synced 2025-12-17 03:45:46 +01:00
add a check for debug logging, to only log when the environment variable DEBUG is set to 1
This commit is contained in:
@@ -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, ...) {
|
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_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
error_log(stdout, "\033[95mDBG\033[0m", ln, file, fmt, ap);
|
error_log(stdout, "\033[95mDBG\033[0m", ln, file, fmt, ap);
|
||||||
|
|||||||
Reference in New Issue
Block a user