diff options
author | Matthew Wild <mwild1@gmail.com> | 2009-01-16 05:20:04 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2009-01-16 05:20:04 +0000 |
commit | 26e856e3d1348427c05b4cefd5460abd3bc17407 (patch) | |
tree | 9d5b310ce414c91f8c2d43325017f8b965e7de2e | |
parent | 1c899aec8da24ca76985ca27689322165f0ba698 (diff) | |
download | prosody-26e856e3d1348427c05b4cefd5460abd3bc17407.tar.gz prosody-26e856e3d1348427c05b4cefd5460abd3bc17407.zip |
pposix: Add syslog_setmask (use config: minimum_log_level = 'warn' etc.)
-rw-r--r-- | util-src/pposix.c | 17 |
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"); |