Diff

core/loggingmanager.lua @ 4141:ef94984c44a0

loggingmanager: Allow specifying a sink type in per-level logging config (thanks ruskie)
author Matthew Wild <mwild1@gmail.com>
date Sun, 13 Feb 2011 18:37:34 +0000
parent 4140:e463e1df1bda
child 4427:ae71ae5ddcfc
line wrap: on
line diff
--- a/core/loggingmanager.lua	Sun Feb 13 18:35:39 2011 +0000
+++ b/core/loggingmanager.lua	Sun Feb 13 18:37:34 2011 +0000
@@ -88,14 +88,20 @@
 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 = "file",
-						filename = logging_config[level],
-						timestamps = true,
-						levels = { min = level },
+						to = sink_type;
+						filename = value;
+						timestamps = true;
+						levels = { min = level };
+					});
+				elseif value == "*"..sink_type then
+					add_rule({
+						to = sink_type;
+						levels = { min = level };
 					});
 				end
 			end