diff options
| author | Joel Stålnacke <joel@saker.fi> | 2026-03-23 19:50:18 +0200 |
|---|---|---|
| committer | Joel Stålnacke <joel@saker.fi> | 2026-03-23 19:50:18 +0200 |
| commit | 3a1f9fe6800ef5fe7bbf1c0a5976720383ba84fe (patch) | |
| tree | f1218eb4085a654f6bb70671b41b4a74e646c052 /lib/log.c | |
| parent | 3870982f640260822bf605e693782ce9f5d79cf6 (diff) | |
Rewrite native code in Odin and use ECSodin
Diffstat (limited to 'lib/log.c')
| -rw-r--r-- | lib/log.c | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/lib/log.c b/lib/log.c deleted file mode 100644 index c45f735..0000000 --- a/lib/log.c +++ /dev/null @@ -1,55 +0,0 @@ -#include <stdarg.h> -#include <stdlib.h> -#include <stdio.h> - -#include "log.h" - -/* Message buffer */ -#define MBUF_SIZE 512 - -static void (*log_output)(int level, const char *source, int line, const char *msg) = NULL; -static int min_level = LOGL_INFO; - -void -dp_log_set_output(void (*output)(int, const char *, int, const char *)) -{ - log_output = output; -} - -void -dp_log_set_level(int level) -{ - min_level = level; -} - -void -dp_log_write(int level, const char *source, int line, const char *fmt, ...) -{ - char mbuf[MBUF_SIZE]; - char *msg; - va_list va; - int len; - - if (level < min_level) - return; - if (!log_output) - return; - - msg = mbuf; - va_start(va, fmt); - len = vsnprintf(msg, MBUF_SIZE, fmt, va); - va_end(va); - - if (len >= MBUF_SIZE) - { - msg = (char *)malloc(len + 1); - va_start(va, fmt); - len = vsnprintf(msg, len + 1, fmt, va); - va_end(va); - } - - log_output(level, source, line, msg); - - if (msg != mbuf) - free(msg); -} |
