Comparison

util/logger.lua @ 12975:d10957394a3c

util: Prefix module imports with prosody namespace
author Kim Alvefur <zash@zash.se>
date Fri, 17 Mar 2023 16:23:16 +0100
parent 12395:1e34b910b73a
comparison
equal deleted inserted replaced
12974:ba409c67353b 12975:d10957394a3c
70 level_sinks[level][#level_sinks[level] + 1 ] = sink_function; 70 level_sinks[level][#level_sinks[level] + 1 ] = sink_function;
71 end 71 end
72 end 72 end
73 73
74 local function add_simple_sink(simple_sink_function, levels) 74 local function add_simple_sink(simple_sink_function, levels)
75 local format = require "util.format".format; 75 local format = require "prosody.util.format".format;
76 local function sink_function(name, level, msg, ...) 76 local function sink_function(name, level, msg, ...)
77 return simple_sink_function(name, level, format(msg, ...)); 77 return simple_sink_function(name, level, format(msg, ...));
78 end 78 end
79 for _, level in ipairs(levels or {"debug", "info", "warn", "error"}) do 79 for _, level in ipairs(levels or {"debug", "info", "warn", "error"}) do
80 add_level_sink(level, sink_function); 80 add_level_sink(level, sink_function);