annotate mod_log_rate/mod_log_rate.lua @ 2214:c2fc3516cca1

mod_privacy_lists: Fix selecting the top resource (fixes #694)
author Kim Alvefur <zash@zash.se>
date Wed, 22 Jun 2016 22:27:22 +0200
parents 217456783219
children f388747c53c7
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 = {
2202
217456783219 mod_log_rate: Use moduleapi
Kim Alvefur <zash@zash.se>
parents: 1762
diff changeset
5 debug = measure("log.debug", "rate");
217456783219 mod_log_rate: Use moduleapi
Kim Alvefur <zash@zash.se>
parents: 1762
diff changeset
6 info = measure("log.info", "rate");
217456783219 mod_log_rate: Use moduleapi
Kim Alvefur <zash@zash.se>
parents: 1762
diff changeset
7 warn = measure("log.warn", "rate");
217456783219 mod_log_rate: Use moduleapi
Kim Alvefur <zash@zash.se>
parents: 1762
diff changeset
8 error = 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);