From 01b695eb6a1509996f9c73d71c59731bf17f5aa7 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Thu, 5 Feb 2026 03:57:33 +0000 Subject: [PATCH] base: implement LOG macro which only prints if VERBOSE_LOGS = 1 This allows us to make builds that don't have verbose logging, whether they're debug or not. We could have release builds that have verbose logging. --- include/alisp/base.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/alisp/base.h b/include/alisp/base.h index cd11903..99c8792 100644 --- a/include/alisp/base.h +++ b/include/alisp/base.h @@ -19,6 +19,20 @@ #define FAIL(MSG) assert(false && "FAIL: " #MSG) #define TODO(MSG) assert(false && "TODO: " #MSG) +#ifndef VERBOSE_LOGS +#define VERBOSE_LOGS 0 +#endif + +#if VERBOSE_LOGS +#define LOG(...) \ + do \ + { \ + printf(__VA_ARGS__); \ + } while (0) +#else +#define LOG(...) +#endif + /// Numeric aliases typedef uint8_t u8; typedef uint16_t u16;