diff options
author | Matthew Wild <mwild1@gmail.com> | 2009-01-15 20:06:41 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2009-01-15 20:06:41 +0000 |
commit | 333914c98df72a4feb622d35222f4f2b8a2afb51 (patch) | |
tree | bedcdf20f12151410ef31ac1a9329780b4951cc8 /plugins/mod_posix.lua | |
parent | 202b9193db40c10718b139f6e8c7bebba662f049 (diff) | |
download | prosody-333914c98df72a4feb622d35222f4f2b8a2afb51.tar.gz prosody-333914c98df72a4feb622d35222f4f2b8a2afb51.zip |
mod_posix: Support for logging to syslog (log = 'syslog' in config)
Diffstat (limited to 'plugins/mod_posix.lua')
-rw-r--r-- | plugins/mod_posix.lua | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/mod_posix.lua b/plugins/mod_posix.lua index 7559d3ed..23757761 100644 --- a/plugins/mod_posix.lua +++ b/plugins/mod_posix.lua @@ -11,7 +11,17 @@ if not config_get("*", "core", "no_daemonize") then 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; |