plugins/mod_posix.lua

changeset 722
63456c9d0522
parent 594
6d9b2da9888f
child 723
c1e7d280c174
--- 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;

mercurial