aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriamcheeseman <[email protected]>2026-05-10 16:46:59 -0400
committeriamcheeseman <[email protected]>2026-05-10 16:46:59 -0400
commitd3a46ff56d42240c2b8d408f505ac28e54a0d386 (patch)
tree2597c6295c5c0303d2a7c656bebebe8d3651acc0
parent576bd27e11ec70bdbd1b9a644d2e227b57586337 (diff)
add `ty_log_debug()`
It's useful to have output that only appears in debug builds. The macro is defined to be empty in release builds, so the output isn't polluted by random log statements in release.
-rw-r--r--dc/dc.c2
-rw-r--r--teensy/teensy_log.h8
2 files changed, 9 insertions, 1 deletions
diff --git a/dc/dc.c b/dc/dc.c
index acb1e74..942174b 100644
--- a/dc/dc.c
+++ b/dc/dc.c
@@ -78,7 +78,7 @@ int main(void)
ty_sleep(1000 / hints.ticrate);
- ty_log_info("%g ms", (float)(clock() - start) / CLOCKS_PER_SEC);
+ ty_log_debug("%g ms", (float)(clock() - start) / CLOCKS_PER_SEC);
}
ty_free_image(img);
diff --git a/teensy/teensy_log.h b/teensy/teensy_log.h
index 825ce55..9c54d62 100644
--- a/teensy/teensy_log.h
+++ b/teensy/teensy_log.h
@@ -15,6 +15,14 @@
#define ty_log_fatal(ec, fmt, ...) \
(ty_log_msg(stderr, __FILE__, __LINE__, "fatal", fmt, ## __VA_ARGS__), \
exit(ec))
+
+#if defined(TEENSY_DEBUG) || !defined(NDEBUG)
+#define ty_log_debug(fmt, ...) \
+ ty_log_msg(stderr, __FILE__, __LINE__, "debug", fmt, ## __VA_ARGS__)
+#else
+#define ty_log_debug(fmt, ...)
+#endif // TEENSY_DEBUG
+
#define ty_olog(fmt, ...) \
_log_plain(stdout, fmt, ## __VA_ARGS__)
#define ty_elog(fmt, ...) \