Software /
code /
prosody
Diff
plugins/mod_posix.lua @ 722:63456c9d0522
mod_posix: Support for logging to syslog (log = 'syslog' in config)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 15 Jan 2009 20:06:41 +0000 |
parent | 594:6d9b2da9888f |
child | 723:c1e7d280c174 |
line wrap: on
line diff
--- a/plugins/mod_posix.lua Thu Jan 15 20:02:28 2009 +0000 +++ b/plugins/mod_posix.lua Thu Jan 15 20:06:41 2009 +0000 @@ -11,7 +11,17 @@ local logwriter; local logfilename = config_get("*", "core", "log"); - if logfilename then + if logfilename == "syslog" then + pposix.syslog_open("prosody"); + local syslog, format = pposix.syslog_log, string.format; + logwriter = function (name, level, message, ...) + if ... then + syslog(level, format(message, ...)); + else + syslog(level, message); + end + end; + elseif logfilename then local logfile = io.open(logfilename, "a+"); if logfile then local write, format, flush = logfile.write, string.format, logfile.flush;