Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
6616:5d2346e72716 | 6617:a455dac79f58 |
---|---|
43 | 43 |
44 -- Put a rule into action. Requires that the sink type has already been registered. | 44 -- Put a rule into action. Requires that the sink type has already been registered. |
45 -- This function is called automatically when a new sink type is added [see apply_sink_rules()] | 45 -- This function is called automatically when a new sink type is added [see apply_sink_rules()] |
46 local function add_rule(sink_config) | 46 local function add_rule(sink_config) |
47 local sink_maker = log_sink_types[sink_config.to]; | 47 local sink_maker = log_sink_types[sink_config.to]; |
48 if sink_maker then | 48 if not sink_maker then |
49 -- Create sink | 49 return; -- No such sink type |
50 local sink = sink_maker(sink_config); | 50 end |
51 | 51 |
52 -- Set sink for all chosen levels | 52 -- Create sink |
53 for level in pairs(get_levels(sink_config.levels or logging_levels)) do | 53 local sink = sink_maker(sink_config); |
54 logger.add_level_sink(level, sink); | 54 |
55 end | 55 -- Set sink for all chosen levels |
56 else | 56 for level in pairs(get_levels(sink_config.levels or logging_levels)) do |
57 -- No such sink type | 57 logger.add_level_sink(level, sink); |
58 end | 58 end |
59 end | 59 end |
60 | 60 |
61 -- Search for all rules using a particular sink type, and apply | 61 -- Search for all rules using a particular sink type, and apply |
62 -- them. Called automatically when a new sink type is added to | 62 -- them. Called automatically when a new sink type is added to |