Software /
code /
prosody
Diff
core/loggingmanager.lua @ 6617:a455dac79f58
loggingmanager: Improve code structure (removes empty if branch)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 03 Apr 2015 19:20:24 +0100 |
parent | 5776:bd0ff8ae98a8 |
child | 6719:0ef7a8c8fe8c |
line wrap: on
line diff
--- a/core/loggingmanager.lua Fri Apr 03 19:13:35 2015 +0100 +++ b/core/loggingmanager.lua Fri Apr 03 19:20:24 2015 +0100 @@ -45,16 +45,16 @@ -- 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