mirror of
https://github.com/bjc/prosody.git
synced 2025-04-05 14:17:37 +03:00
mod_posix: Support for logging to syslog (log = 'syslog' in config)
This commit is contained in:
parent
202b9193db
commit
333914c98d
2 changed files with 140 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue