Software /
code /
prosody
Changeset
5449:35a271b4b920
util.pposix: syslog(): Support an optional source parameter (producing messages of the form '<source>: <message>'
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 08 Apr 2013 16:56:40 +0100 |
parents | 5448:cbe9fa2d3787 |
children | 5450:cc83b1a50fde |
files | util-src/pposix.c |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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; }