diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/l_log.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/l_log.c b/src/l_log.c index e7caffe..8213751 100644 --- a/src/l_log.c +++ b/src/l_log.c @@ -30,9 +30,6 @@ #include "l_log.h" -/* void log_printf(log_prio_t prio, const char* fmt, ...); */ -/* void log_print_hex_dump(log_prio_t prio, const u_int8_t* buf, u_int32_t len); */ - static int l_log_init(lua_State *L) { log_init(); @@ -45,6 +42,25 @@ static int l_log_close(lua_State *L) return 0; } +static int l_log_add_target(lua_State *L) +{ + int ret = log_add_target(luaL_checklstring(L,1,NULL)); + if(ret) { + lua_pushboolean(L, 0); + switch(ret) { + case -2: lua_pushstring(L, "memory error at log_add_target"); break; + case -3: lua_pushstring(L, "unknown log target"); break; + case -4: lua_pushstring(L, "this log target is only allowed once"); break; + default: lua_pushstring(L, "syntax error"); break; + } + return 2; + } + + lua_pushboolean(L, 1); + return 1; +} + +/* void log_printf(log_prio_t prio, const char* fmt, ...); */ static int l_log_print(lua_State *L) { const char* prio_str = luaL_checklstring(L,1,NULL); @@ -74,29 +90,13 @@ static int l_log_print(lua_State *L) return 0; } -static int l_log_add_target(lua_State *L) -{ - int ret = log_add_target(luaL_checklstring(L,1,NULL)); - if(ret) { - lua_pushboolean(L, 0); - switch(ret) { - case -2: lua_pushstring(L, "memory error at log_add_target"); break; - case -3: lua_pushstring(L, "unknown log target"); break; - case -4: lua_pushstring(L, "this log target is only allowed once"); break; - default: lua_pushstring(L, "syntax error"); break; - } - return 2; - } - - lua_pushboolean(L, 1); - return 1; -} +/* void log_print_hex_dump(log_prio_t prio, const u_int8_t* buf, u_int32_t len); */ static const struct luaL_reg loglib [] = { { "init", l_log_init }, { "close", l_log_close }, - { "print", l_log_print }, { "add_target", l_log_add_target }, + { "print", l_log_print }, { NULL, NULL } }; |