Software / code / prosody
Comparison
plugins/mod_posix.lua @ 5453:116971a751d3
Merge 0.9->trunk
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 08 Apr 2013 17:22:15 +0100 |
| parent | 5452:edf3db386a19 |
| child | 5776:bd0ff8ae98a8 |
| child | 6357:ccae56e34956 |
comparison
equal
deleted
inserted
replaced
| 5446:51686426cac2 | 5453:116971a751d3 |
|---|---|
| 5 -- This project is MIT/X11 licensed. Please see the | 5 -- This project is MIT/X11 licensed. Please see the |
| 6 -- COPYING file in the source package for more information. | 6 -- COPYING file in the source package for more information. |
| 7 -- | 7 -- |
| 8 | 8 |
| 9 | 9 |
| 10 local want_pposix_version = "0.3.5"; | 10 local want_pposix_version = "0.3.6"; |
| 11 | 11 |
| 12 local pposix = assert(require "util.pposix"); | 12 local pposix = assert(require "util.pposix"); |
| 13 if pposix._VERSION ~= want_pposix_version then module:log("warn", "Unknown version (%s) of binary pposix module, expected %s", tostring(pposix._VERSION), want_pposix_version); end | 13 if pposix._VERSION ~= want_pposix_version then |
| 14 module:log("warn", "Unknown version (%s) of binary pposix module, expected %s. Perhaps you need to recompile?", tostring(pposix._VERSION), want_pposix_version); | |
| 15 end | |
| 14 | 16 |
| 15 local signal = select(2, pcall(require, "util.signal")); | 17 local signal = select(2, pcall(require, "util.signal")); |
| 16 if type(signal) == "string" then | 18 if type(signal) == "string" then |
| 17 module:log("warn", "Couldn't load signal library, won't respond to SIGTERM"); | 19 module:log("warn", "Couldn't load signal library, won't respond to SIGTERM"); |
| 18 end | 20 end |
| 116 syslog_opened = true; | 118 syslog_opened = true; |
| 117 end | 119 end |
| 118 local syslog, format = pposix.syslog_log, string.format; | 120 local syslog, format = pposix.syslog_log, string.format; |
| 119 return function (name, level, message, ...) | 121 return function (name, level, message, ...) |
| 120 if ... then | 122 if ... then |
| 121 syslog(level, format(message, ...)); | 123 syslog(level, name, format(message, ...)); |
| 122 else | 124 else |
| 123 syslog(level, message); | 125 syslog(level, name, message); |
| 124 end | 126 end |
| 125 end; | 127 end; |
| 126 end | 128 end |
| 127 require "core.loggingmanager".register_sink_type("syslog", syslog_sink_maker); | 129 require "core.loggingmanager".register_sink_type("syslog", syslog_sink_maker); |
| 128 | 130 |