summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-02-23 00:26:08 -0600
committersanine <sanine.not@pm.me>2023-02-23 00:26:08 -0600
commitd61633a46ba4b6b3dce72e8d3cb20807f3f1add7 (patch)
tree843069ddfb40a8c5525c9abf0abc0f8316977bad
parent668d9bbdb48c3cb474398a8a185a4b5c3679cf9c (diff)
refactor: remove honeysuckle from logging
-rw-r--r--src/logging/logging.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/logging/logging.c b/src/logging/logging.c
index f7583c0..80df382 100644
--- a/src/logging/logging.c
+++ b/src/logging/logging.c
@@ -1,16 +1,16 @@
#include <stdio.h>
#include <stdarg.h>
#include <lua.h>
-#include <honeysuckle.h>
-#include "logging/logging.h"
+#include <lauxlib.h>
+#include "util/util.h"
+#include "logging.h"
int _honey_log_level = HONEY_WARN;
#define LUA_LOG(level) \
int log_ ## level (lua_State *L) { \
- char *msg; \
- hs_parse_args(L, hs_str(msg)); \
+ const char *msg = luaL_checkstring(L, 1); \
honey_log_ ## level ("%s\n", msg); \
return 0; \
}
@@ -26,15 +26,16 @@ LUA_LOG(trace);
void setup_logging(lua_State *L, int honey_tbl)
{
- hs_create_table(L,
- hs_str_cfunc("fatal", log_fatal),
- hs_str_cfunc("error", log_error),
- hs_str_cfunc("warn", log_warn),
- hs_str_cfunc("info", log_info),
- hs_str_cfunc("debug", log_debug),
- hs_str_cfunc("trace", log_trace),
- );
-
+ struct honey_tbl_t log[] = {
+ H_FUNC("fatal", log_fatal),
+ H_FUNC("error", log_error),
+ H_FUNC("warn", log_warn),
+ H_FUNC("info", log_info),
+ H_FUNC("debug", log_debug),
+ H_FUNC("trace", log_trace),
+ H_END
+ };
+ create_table(L, log);
lua_setfield(L, honey_tbl, "log");
}