aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2015-04-03 19:20:24 +0100
committerMatthew Wild <mwild1@gmail.com>2015-04-03 19:20:24 +0100
commitb13254c2335e51a71717381956ee9a1653b2a129 (patch)
treee31f477ef1251e4884758221129836f205155a0c /core
parentc71e65917c71c44c90bb6298f87d1d9cbdcab283 (diff)
downloadprosody-b13254c2335e51a71717381956ee9a1653b2a129.tar.gz
prosody-b13254c2335e51a71717381956ee9a1653b2a129.zip
loggingmanager: Improve code structure (removes empty if branch)
Diffstat (limited to 'core')
-rw-r--r--core/loggingmanager.lua18
1 files changed, 9 insertions, 9 deletions
diff --git a/core/loggingmanager.lua b/core/loggingmanager.lua
index c6361146..f348dbdf 100644
--- a/core/loggingmanager.lua
+++ b/core/loggingmanager.lua
@@ -45,16 +45,16 @@ local logging_levels = { "debug", "info", "warn", "error" }
-- This function is called automatically when a new sink type is added [see apply_sink_rules()]
local function add_rule(sink_config)
local sink_maker = log_sink_types[sink_config.to];
- if sink_maker then
- -- Create sink
- local sink = sink_maker(sink_config);
+ if not sink_maker then
+ return; -- No such sink type
+ end
- -- Set sink for all chosen levels
- for level in pairs(get_levels(sink_config.levels or logging_levels)) do
- logger.add_level_sink(level, sink);
- end
- else
- -- No such sink type
+ -- Create sink
+ local sink = sink_maker(sink_config);
+
+ -- Set sink for all chosen levels
+ for level in pairs(get_levels(sink_config.levels or logging_levels)) do
+ logger.add_level_sink(level, sink);
end
end