Software /
code /
prosody-modules
Comparison
mod_log_rate/mod_log_rate.lua @ 1762:e6c7fe1be6cd
mod_log_rate: Log sink that reports the rate of log messages to statsmanager
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 27 May 2015 13:31:33 +0200 |
child | 2202:217456783219 |
comparison
equal
deleted
inserted
replaced
1761:6f34e51a23f0 | 1762:e6c7fe1be6cd |
---|---|
1 module:set_global(); | |
2 | |
3 local measure = require"core.statsmanager".measure; | |
4 | |
5 local function sink_maker(config) | |
6 local levels = { | |
7 debug = measure("rate", "log.debug"); | |
8 info = measure("rate", "log.info"); | |
9 warn = measure("rate", "log.warn"); | |
10 error = measure("rate", "log.error"); | |
11 }; | |
12 return function (_, level) | |
13 return levels[level](); | |
14 end | |
15 end | |
16 | |
17 require"core.loggingmanager".register_sink_type("measure", sink_maker); |