# HG changeset patch # User Matthew Wild # Date 1232083204 0 # Node ID f62ef65d5c01f9299d874759e7848fa273aa080d # Parent fa45dfb27ee54a61f05158ccb640775cf6413814 pposix: Add syslog_setmask (use config: minimum_log_level = 'warn' etc.) diff -r fa45dfb27ee5 -r f62ef65d5c01 util-src/pposix.c --- 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");