aboutsummaryrefslogtreecommitdiffstats
path: root/core/loggingmanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2011-02-13 18:37:34 +0000
committerMatthew Wild <mwild1@gmail.com>2011-02-13 18:37:34 +0000
commit29747bfa1eecda2e0df3fb6d3359126dec5a7eb2 (patch)
tree2ddab94c664208d900766a01efebe48951f5ac35 /core/loggingmanager.lua
parent807eb44ee649b509d5284da4f44dfd702e8781f0 (diff)
downloadprosody-29747bfa1eecda2e0df3fb6d3359126dec5a7eb2.tar.gz
prosody-29747bfa1eecda2e0df3fb6d3359126dec5a7eb2.zip
loggingmanager: Allow specifying a sink type in per-level logging config (thanks ruskie)
Diffstat (limited to 'core/loggingmanager.lua')
-rw-r--r--core/loggingmanager.lua20
1 files changed, 13 insertions, 7 deletions
diff --git a/core/loggingmanager.lua b/core/loggingmanager.lua
index be76681d..88f2bbbf 100644
--- a/core/loggingmanager.lua
+++ b/core/loggingmanager.lua
@@ -88,14 +88,20 @@ end
function apply_sink_rules(sink_type)
if type(logging_config) == "table" then
- if sink_type == "file" then
- for _, level in ipairs(logging_levels) do
- if type(logging_config[level]) == "string" then
+ for _, level in ipairs(logging_levels) do
+ if type(logging_config[level]) == "string" then
+ local value = logging_config[level];
+ if sink_type == "file" then
+ add_rule({
+ to = sink_type;
+ filename = value;
+ timestamps = true;
+ levels = { min = level };
+ });
+ elseif value == "*"..sink_type then
add_rule({
- to = "file",
- filename = logging_config[level],
- timestamps = true,
- levels = { min = level },
+ to = sink_type;
+ levels = { min = level };
});
end
end