Comparison

plugins/mod_posix.lua @ 8235:7d9a2c200736

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Thu, 14 Sep 2017 02:48:34 +0200
parent 8168:45be94611593
parent 8228:cda9db4b881d
child 8663:a7a9d9511dc1
comparison
equal deleted inserted replaced
8221:4989a625419a 8235:7d9a2c200736
18 local have_signal, signal = pcall(require, "util.signal"); 18 local have_signal, signal = pcall(require, "util.signal");
19 if not have_signal then 19 if not have_signal then
20 module:log("warn", "Couldn't load signal library, won't respond to SIGTERM"); 20 module:log("warn", "Couldn't load signal library, won't respond to SIGTERM");
21 end 21 end
22 22
23 local format = require "util.format".format;
23 local lfs = require "lfs"; 24 local lfs = require "lfs";
24 local stat = lfs.attributes; 25 local stat = lfs.attributes;
25 26
26 local prosody = _G.prosody; 27 local prosody = _G.prosody;
27 28
116 function syslog_sink_maker(config) -- luacheck: ignore 212/config 117 function syslog_sink_maker(config) -- luacheck: ignore 212/config
117 if not syslog_opened then 118 if not syslog_opened then
118 pposix.syslog_open("prosody", module:get_option_string("syslog_facility")); 119 pposix.syslog_open("prosody", module:get_option_string("syslog_facility"));
119 syslog_opened = true; 120 syslog_opened = true;
120 end 121 end
121 local syslog, format = pposix.syslog_log, string.format; 122 local syslog = pposix.syslog_log;
122 return function (name, level, message, ...) 123 return function (name, level, message, ...)
123 if ... then 124 syslog(level, name, format(message, ...));
124 syslog(level, name, format(message, ...));
125 else
126 syslog(level, name, message);
127 end
128 end; 125 end;
129 end 126 end
130 require "core.loggingmanager".register_sink_type("syslog", syslog_sink_maker); 127 require "core.loggingmanager".register_sink_type("syslog", syslog_sink_maker);
131 128
132 local daemonize = module:get_option("daemonize", prosody.installed); 129 local daemonize = module:get_option("daemonize", prosody.installed);