From d61633a46ba4b6b3dce72e8d3cb20807f3f1add7 Mon Sep 17 00:00:00 2001 From: sanine Date: Thu, 23 Feb 2023 00:26:08 -0600 Subject: refactor: remove honeysuckle from logging --- src/logging/logging.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'src') 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 #include #include -#include -#include "logging/logging.h" +#include +#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"); } -- cgit v1.2.1