annotate mod_log_rate/mod_log_rate.lua @ 4326:f6fdefc5c6ac

mod_roster_command: Fix subscription when the "user JID" is a bare domain. Do not attempt to update the roster when the user is bare domain (e.g. a component), since they don't have rosters and the attempt results in an error: $ prosodyctl mod_roster_command subscribe proxy.example.com contact@example.com xxxxxxxxxxFailed to execute command: Error: /usr/lib/prosody/core/rostermanager.lua:104: attempt to concatenate local 'username' (a nil value) stack traceback: /usr/lib/prosody/core/rostermanager.lua:104: in function 'load_roster' /usr/lib/prosody/core/rostermanager.lua:305: in function 'set_contact_pending_out' mod_roster_command.lua:44: in function 'subscribe'
author Boris Grozev <boris@jitsi.org>
date Tue, 05 Jan 2021 13:15:00 -0600
parents f388747c53c7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1762
e6c7fe1be6cd mod_log_rate: Log sink that reports the rate of log messages to statsmanager
Kim Alvefur <zash@zash.se>
parents:
diff changeset
1 module:set_global();
e6c7fe1be6cd mod_log_rate: Log sink that reports the rate of log messages to statsmanager
Kim Alvefur <zash@zash.se>
parents:
diff changeset
2
e6c7fe1be6cd mod_log_rate: Log sink that reports the rate of log messages to statsmanager
Kim Alvefur <zash@zash.se>
parents:
diff changeset
3 local function sink_maker(config)
e6c7fe1be6cd mod_log_rate: Log sink that reports the rate of log messages to statsmanager
Kim Alvefur <zash@zash.se>
parents:
diff changeset
4 local levels = {
2243
f388747c53c7 mod_log_rate: Fix to actually use module methods
Kim Alvefur <zash@zash.se>
parents: 2202
diff changeset
5 debug = module:measure("log.debug", "rate");
f388747c53c7 mod_log_rate: Fix to actually use module methods
Kim Alvefur <zash@zash.se>
parents: 2202
diff changeset
6 info = module:measure("log.info", "rate");
f388747c53c7 mod_log_rate: Fix to actually use module methods
Kim Alvefur <zash@zash.se>
parents: 2202
diff changeset
7 warn = module:measure("log.warn", "rate");
f388747c53c7 mod_log_rate: Fix to actually use module methods
Kim Alvefur <zash@zash.se>
parents: 2202
diff changeset
8 error = module:measure("log.error", "rate");
1762
e6c7fe1be6cd mod_log_rate: Log sink that reports the rate of log messages to statsmanager
Kim Alvefur <zash@zash.se>
parents:
diff changeset
9 };
e6c7fe1be6cd mod_log_rate: Log sink that reports the rate of log messages to statsmanager
Kim Alvefur <zash@zash.se>
parents:
diff changeset
10 return function (_, level)
e6c7fe1be6cd mod_log_rate: Log sink that reports the rate of log messages to statsmanager
Kim Alvefur <zash@zash.se>
parents:
diff changeset
11 return levels[level]();
e6c7fe1be6cd mod_log_rate: Log sink that reports the rate of log messages to statsmanager
Kim Alvefur <zash@zash.se>
parents:
diff changeset
12 end
e6c7fe1be6cd mod_log_rate: Log sink that reports the rate of log messages to statsmanager
Kim Alvefur <zash@zash.se>
parents:
diff changeset
13 end
e6c7fe1be6cd mod_log_rate: Log sink that reports the rate of log messages to statsmanager
Kim Alvefur <zash@zash.se>
parents:
diff changeset
14
e6c7fe1be6cd mod_log_rate: Log sink that reports the rate of log messages to statsmanager
Kim Alvefur <zash@zash.se>
parents:
diff changeset
15 require"core.loggingmanager".register_sink_type("measure", sink_maker);