mod_posix: Support for logging to syslog (log = 'syslog' in config)

This commit is contained in:
Matthew Wild 2009-01-15 20:06:41 +00:00
parent 202b9193db
commit 333914c98d
2 changed files with 140 additions and 1 deletions

View file

@ -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;