aboutsummaryrefslogtreecommitdiffstats
path: root/util-src/pposix.c
diff options
context:
space:
mode:
Diffstat (limited to 'util-src/pposix.c')
-rw-r--r--util-src/pposix.c17
1 files changed, 17 insertions, 0 deletions
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");