loggingmanager: Iterate over logging config rules using ipairs rather than pairs
[prosody.git] / core / loggingmanager.lua
index 88f2bbbf506453d349427e2cb10de667ab2f200f..be76681dd8ba217f1d218c33287cb37762897ec4 100644 (file)
@@ -88,20 +88,14 @@ end
 function apply_sink_rules(sink_type)
        if type(logging_config) == "table" 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
+               if sink_type == "file" then
+                       for _, level in ipairs(logging_levels) do
+                               if type(logging_config[level]) == "string" then
                                        add_rule({
-                                               to = sink_type;
-                                               levels = { min = level };
+                                               to = "file",
+                                               filename = logging_config[level],
+                                               timestamps = true,
+                                               levels = { min = level },
                                        });
                                end
                        end