# HG changeset patch # User Matthew Wild # Date 1365436600 -3600 # Node ID 35a271b4b920fcaa1f829f1c9730f3a6b66ef0bf # Parent cbe9fa2d3787d0da409019970ac81db01a56cb7e util.pposix: syslog(): Support an optional source parameter (producing messages of the form ': ' diff -r cbe9fa2d3787 -r 35a271b4b920 util-src/pposix.c --- a/util-src/pposix.c Mon Apr 08 16:40:27 2013 +0100 +++ b/util-src/pposix.c Mon Apr 08 16:56:40 2013 +0100 @@ -204,12 +204,13 @@ }; int lc_syslog_log(lua_State* L) { - int level = luaL_checkoption(L, 1, "notice", level_strings); - level = level_constants[level]; + int level = level_constants[luaL_checkoption(L, 1, "notice", level_strings)]; - luaL_checkstring(L, 2); + if(lua_gettop(L) == 3) + syslog(level, "%s: %s", luaL_checkstring(L, 2), luaL_checkstring(L, 3)); + else + syslog(level, "%s", lua_tostring(L, 2)); - syslog(level, "%s", lua_tostring(L, 2)); return 0; }