view mod_log_rate/mod_log_rate.lua @ 5218:1f4b768c831a

mod_http_oauth2: Correct field name for HTTP response status code 'code' is used in the incoming side of the Prosody HTTP stack while 'status_code' is used on the response side. Not confusing at all. The default is 200 so this mistake had no real effect.
author Kim Alvefur <zash@zash.se>
date Tue, 07 Mar 2023 13:14:25 +0100
parents f388747c53c7
children
line wrap: on
line source

module:set_global();

local function sink_maker(config)
	local levels = {
		debug = module:measure("log.debug", "rate");
		info = module:measure("log.info", "rate");
		warn = module:measure("log.warn", "rate");
		error = module:measure("log.error", "rate");
	};
	return function (_, level)
		return levels[level]();
	end
end

require"core.loggingmanager".register_sink_type("measure", sink_maker);