From 25fa078c98c782d83eb341d0c5c2fcf9903bfd5c Mon Sep 17 00:00:00 2001 From: Quinn Date: Mon, 15 Sep 2025 13:36:42 +0200 Subject: [PATCH] add a check for debug logging, to only log when the environment variable `DEBUG` is set to `1` --- src/error.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/error.c b/src/error.c index 6c74eff..bda67b0 100644 --- a/src/error.c +++ b/src/error.c @@ -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);