Software /
code /
prosody
Changeset
9925:8d0112413997
Backed out changeset 3eea63a68e0f
Commit included intended changes to loggingmanager
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 26 Mar 2019 13:51:06 +0000 |
parents | 9924:5a2e53bef031 |
children | 9926:1bfd28e774db |
files | core/loggingmanager.lua util/queue.lua |
diffstat | 2 files changed, 6 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/core/loggingmanager.lua Mon Mar 25 14:37:43 2019 +0000 +++ b/core/loggingmanager.lua Tue Mar 26 13:51:06 2019 +0000 @@ -18,9 +18,6 @@ local config = require "core.configmanager"; local logger = require "util.logger"; -local have_pposix, pposix = pcall(require, "util.pposix"); -have_pposix = have_pposix and pposix._VERSION == "0.4.4"; - local _ENV = nil; -- luacheck: std none @@ -48,8 +45,7 @@ local sink = sink_maker(sink_config); -- Set sink for all chosen levels - local levels = get_levels(sink_config.levels or logging_levels); - for level in pairs(levels) do + for level in pairs(get_levels(sink_config.levels or logging_levels)) do logger.add_level_sink(level, sink); end end @@ -236,21 +232,6 @@ end log_sink_types.console = log_to_console; -if have_pposix then - local syslog_opened; - local function log_to_syslog(sink_config) -- luacheck: ignore 212/sink_config - if not syslog_opened then - pposix.syslog_open(sink_config.syslog_name or "prosody", sink_config.syslog_facility or config.get("*", "syslog_facility")); - syslog_opened = true; - end - local syslog = pposix.syslog_log; - return function (name, level, message, ...) - syslog(level, name, format(message, ...)); - end; - end - log_sink_types.syslog = log_to_syslog; -end - local function register_sink_type(name, sink_maker) local old_sink_maker = log_sink_types[name]; log_sink_types[name] = sink_maker;
--- a/util/queue.lua Mon Mar 25 14:37:43 2019 +0000 +++ b/util/queue.lua Tue Mar 26 13:51:06 2019 +0000 @@ -52,15 +52,16 @@ return t[tail]; end; items = function (self) - return function (_, pos) - if pos >= items then + --luacheck: ignore 431/t + return function (t, pos) + if pos >= t:count() then return nil; end local read_pos = tail + pos; - if read_pos > self.size then + if read_pos > t.size then read_pos = (read_pos%size); end - return pos+1, t[read_pos]; + return pos+1, t._items[read_pos]; end, self, 0; end; consume = function (self)