From 26e856e3d1348427c05b4cefd5460abd3bc17407 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 16 Jan 2009 05:20:04 +0000 Subject: pposix: Add syslog_setmask (use config: minimum_log_level = 'warn' etc.) --- util-src/pposix.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/util-src/pposix.c b/util-src/pposix.c index 2908a5bf..ab359c97 100644 --- a/util-src/pposix.c +++ b/util-src/pposix.c @@ -203,6 +203,20 @@ int lc_syslog_close(lua_State* L) return 0; } +int lc_syslog_setmask(lua_State* L) +{ + int level_idx = luaL_checkoption(L, 1, "notice", &level_strings); + int mask = 0; + do + { + printf("PPOSIX: Setting mask for %s\n", level_strings[level_idx]); + mask |= LOG_MASK(level_constants[level_idx]); + } while (++level_idx<=4); + + setlogmask(mask); + return 0; +} + /* getpid */ int lc_getpid(lua_State* L) @@ -229,6 +243,9 @@ int luaopen_util_pposix(lua_State *L) lua_pushcfunction(L, lc_syslog_log); lua_setfield(L, -2, "syslog_log"); + lua_pushcfunction(L, lc_syslog_setmask); + lua_setfield(L, -2, "syslog_setminlevel"); + lua_pushcfunction(L, lc_getpid); lua_setfield(L, -2, "getpid"); -- cgit v1.2.3