From 0fe401d0a73d545999afccdca08105b3623fb1fe Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sat, 23 May 2026 01:35:18 -0400 Subject: core: Add logging helpers Signed-off-by: Ian Moffett --- core/cescal.c | 3 ++- include/cescal/log.h | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 include/cescal/log.h diff --git a/core/cescal.c b/core/cescal.c index b9a2c17..6c828e1 100644 --- a/core/cescal.c +++ b/core/cescal.c @@ -6,6 +6,7 @@ #include #include #include "cescal/state.h" +#include "cescal/log.h" static void help(void) @@ -37,7 +38,7 @@ main(int argc, char **argv) int opt; if (argc < 2) { - printf("fatal: too few arguments\n"); + cc_error("too few arguments\n"); help(); return -1; } diff --git a/include/cescal/log.h b/include/cescal/log.h new file mode 100644 index 0000000..efa8dfe --- /dev/null +++ b/include/cescal/log.h @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2026, Chloe M. + * Provided under the BSD-3 clause + */ + +#ifndef CESCAL_LOG_H +#define CESCAL_LOG_H 1 + +#include + +#define cc_trace(fmt, ...) \ + printf("[\033[34;40mtrace\033[0m]: ", ##__VA_ARGS__) +#define cc_error(fmt, ...) \ + printf("[\033[31;40merror\033[0m]: ", ##__VA_ARGS__) + +#endif /* !CESCAL_LOG_H */ -- cgit v1.2.3