Software /
code /
prosody
Diff
util-src/pposix.c @ 729:f62ef65d5c01
pposix: Add syslog_setmask (use config: minimum_log_level = 'warn' etc.)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 16 Jan 2009 05:20:04 +0000 |
parent | 727:78c9542de94e |
child | 730:ac951c44751c |
line wrap: on
line diff
--- a/util-src/pposix.c Fri Jan 16 05:18:38 2009 +0000 +++ b/util-src/pposix.c Fri Jan 16 05:20:04 2009 +0000 @@ -203,6 +203,20 @@ 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 @@ 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");