Software /
code /
prosody-modules
Annotate
mod_log_rate/mod_log_rate.lua @ 1893:8064b5e346ab
mod_pubsub_feeds/README: Update wording to be clearer
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 03 Oct 2015 16:53:45 +0200 |
parent | 1762:e6c7fe1be6cd |
child | 2202:217456783219 |
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 measure = require"core.statsmanager".measure; |
e6c7fe1be6cd
mod_log_rate: Log sink that reports the rate of log messages to statsmanager
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 |
e6c7fe1be6cd
mod_log_rate: Log sink that reports the rate of log messages to statsmanager
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 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
|
6 local levels = { |
e6c7fe1be6cd
mod_log_rate: Log sink that reports the rate of log messages to statsmanager
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 debug = measure("rate", "log.debug"); |
e6c7fe1be6cd
mod_log_rate: Log sink that reports the rate of log messages to statsmanager
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 info = measure("rate", "log.info"); |
e6c7fe1be6cd
mod_log_rate: Log sink that reports the rate of log messages to statsmanager
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 warn = measure("rate", "log.warn"); |
e6c7fe1be6cd
mod_log_rate: Log sink that reports the rate of log messages to statsmanager
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 error = measure("rate", "log.error"); |
e6c7fe1be6cd
mod_log_rate: Log sink that reports the rate of log messages to statsmanager
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 }; |
e6c7fe1be6cd
mod_log_rate: Log sink that reports the rate of log messages to statsmanager
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 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
|
13 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
|
14 end |
e6c7fe1be6cd
mod_log_rate: Log sink that reports the rate of log messages to statsmanager
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 end |
e6c7fe1be6cd
mod_log_rate: Log sink that reports the rate of log messages to statsmanager
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 |
e6c7fe1be6cd
mod_log_rate: Log sink that reports the rate of log messages to statsmanager
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 require"core.loggingmanager".register_sink_type("measure", sink_maker); |