Mercurial > prosody-hg
comparison plugins/mod_posix.lua @ 10411:db2a06b9ff98
Merge 0.11->trunk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 16 Nov 2019 16:52:31 +0100 |
| parents | d92ab8c8006a |
| children | 4f655918fef1 |
comparison
equal
deleted
inserted
replaced
| 10410:659b577f280c | 10411:db2a06b9ff98 |
|---|---|
| 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; | |
| 24 local lfs = require "lfs"; | 23 local lfs = require "lfs"; |
| 25 local stat = lfs.attributes; | 24 local stat = lfs.attributes; |
| 26 | 25 |
| 27 local prosody = _G.prosody; | 26 local prosody = _G.prosody; |
| 28 | 27 |
| 111 end | 110 end |
| 112 end | 111 end |
| 113 end | 112 end |
| 114 end | 113 end |
| 115 | 114 |
| 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); | 115 local daemonize = module:get_option("daemonize", prosody.installed); |
| 130 | 116 |
| 131 local function remove_log_sinks() | 117 local function remove_log_sinks() |
| 132 local lm = require "core.loggingmanager"; | 118 local lm = require "core.loggingmanager"; |
| 133 lm.register_sink_type("console", nil); | 119 lm.register_sink_type("console", nil); |
