From a262dc8acd581052ee6b5d5430af69148540a843 Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Sat, 23 Aug 2025 00:01:31 +0200 Subject: Move to luajit and fix logs --- src/comet.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/comet.c') diff --git a/src/comet.c b/src/comet.c index b418c91..1cf5d69 100644 --- a/src/comet.c +++ b/src/comet.c @@ -11,6 +11,26 @@ #include "block.h" #include "lua/api.h" +#define ANY_LOG_FORMAT_BEFORE(stream, level, module, func) \ + fprintf(stream, "[%s%s%s%s%s%s%s] %s%s%s: ", \ + ANY_LOG_COLOR_GET(ANY_LOG_COLOR_MODULE), module, ANY_LOG_COLOR_GET(ANY_LOG_COLOR_RESET), *func ? " " : "", \ + ANY_LOG_COLOR_GET(ANY_LOG_COLOR_FUNC), func, ANY_LOG_COLOR_GET(ANY_LOG_COLOR_RESET), \ + ANY_LOG_COLOR_GET(level), any_log_level_strings[level], ANY_LOG_COLOR_GET(ANY_LOG_COLOR_RESET)) + +#define ANY_LOG_VALUE_BEFORE(stream, level, module, func, message) \ + fprintf(stream, "[%s%s%s%s%s%s%s] %s%s%s: %s [", \ + ANY_LOG_COLOR_GET(ANY_LOG_COLOR_MODULE), module, ANY_LOG_COLOR_GET(ANY_LOG_COLOR_RESET), *func ? " " : "", \ + ANY_LOG_COLOR_GET(ANY_LOG_COLOR_FUNC), func, ANY_LOG_COLOR_GET(ANY_LOG_COLOR_RESET), \ + ANY_LOG_COLOR_GET(level), any_log_level_strings[level], ANY_LOG_COLOR_GET(ANY_LOG_COLOR_RESET), message) + +#define ANY_LOG_VALUE_STRING(stream, key, value) \ + fprintf(stream, "%s=\"%s\"", key, value ? value : "(null)") + +#define ANY_LOG_COLOR_CONTEXT_DEFAULT "\x1b[34m" + +#define ANY_LOG_IMPLEMENT +#include "any_log.h" + static sig_atomic_t running = true; static void signal_quit(int status) -- cgit v1.2.3