Comparison

plugins/mod_posix.lua @ 9927:1460c4966262

loggingmanager, mod_posix: Move syslog to core, fixes #541 (in a way)
author Matthew Wild <mwild1@gmail.com>
date Tue, 26 Mar 2019 14:48:21 +0000
parent 9763:982529dd0bed
child 9928:d92ab8c8006a
comparison
equal deleted inserted replaced
9926:1bfd28e774db 9927:1460c4966262
111 end 111 end
112 end 112 end
113 end 113 end
114 end 114 end
115 115
116 local syslog_opened;
117 function syslog_sink_maker(config) -- luacheck: ignore 212/config
118 if not syslog_opened then
119 pposix.syslog_open("prosody", module:get_option_string("syslog_facility"));
120 syslog_opened = true;
121 end
122 local syslog = pposix.syslog_log;
123 return function (name, level, message, ...)
124 syslog(level, name, format(message, ...));
125 end;
126 end
127 require "core.loggingmanager".register_sink_type("syslog", syslog_sink_maker);
128
129 local daemonize = module:get_option("daemonize", prosody.installed); 116 local daemonize = module:get_option("daemonize", prosody.installed);
130 117
131 local function remove_log_sinks() 118 local function remove_log_sinks()
132 local lm = require "core.loggingmanager"; 119 local lm = require "core.loggingmanager";
133 lm.register_sink_type("console", nil); 120 lm.register_sink_type("console", nil);