aboutsummaryrefslogtreecommitdiff
path: root/src/comet.c
diff options
context:
space:
mode:
authorFederico Angelilli <code@fedang.net>2025-08-23 00:01:31 +0200
committerFederico Angelilli <code@fedang.net>2025-08-23 00:01:31 +0200
commita262dc8acd581052ee6b5d5430af69148540a843 (patch)
treec6eafa7d46f717fdf22eb5565d62e82d80de5fe1 /src/comet.c
parentefdf4a4883937c8a2fad278fbd4ffc207ef981dc (diff)
Move to luajit and fix logsrefactor
Diffstat (limited to 'src/comet.c')
-rw-r--r--src/comet.c20
1 files changed, 20 insertions, 0 deletions
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)