Diff

util/logger.lua @ 4627:b046cafc81a8

loggingmanager, util.logger: Remove name sinks and the ability to filter logs by source name (lots of code, hardly used if at all, and possibly broken)
author Matthew Wild <mwild1@gmail.com>
date Thu, 15 Mar 2012 19:09:24 +0000
parent 3556:d00fc909296e
child 4937:b3fe52353295
line wrap: on
line diff
--- a/util/logger.lua	Thu Mar 15 17:37:07 2012 +0100
+++ b/util/logger.lua	Thu Mar 15 19:09:24 2012 +0000
@@ -13,8 +13,7 @@
 
 module "logger"
 
-local name_sinks, level_sinks = {}, {};
-local name_patterns = {};
+local level_sinks = {};
 
 local make_logger;
 
@@ -46,17 +45,7 @@
 		level_sinks[level] = level_handlers;
 	end
 
-	local source_handlers = name_sinks[source_name];
-	
 	local logger = function (message, ...)
-		if source_handlers then
-			for i = 1,#source_handlers do
-				if source_handlers[i](source_name, level, message, ...) == false then
-					return;
-				end
-			end
-		end
-		
 		for i = 1,#level_handlers do
 			level_handlers[i](source_name, level, message, ...);
 		end
@@ -66,14 +55,12 @@
 end
 
 function reset()
-	for k in pairs(name_sinks) do name_sinks[k] = nil; end
 	for level, handler_list in pairs(level_sinks) do
 		-- Clear all handlers for this level
 		for i = 1, #handler_list do
 			handler_list[i] = nil;
 		end
 	end
-	for k in pairs(name_patterns) do name_patterns[k] = nil; end
 end
 
 function add_level_sink(level, sink_function)
@@ -84,22 +71,6 @@
 	end
 end
 
-function add_name_sink(name, sink_function, exclusive)
-	if not name_sinks[name] then
-		name_sinks[name] = { sink_function };
-	else
-		name_sinks[name][#name_sinks[name] + 1] = sink_function;
-	end
-end
-
-function add_name_pattern_sink(name_pattern, sink_function, exclusive)
-	if not name_patterns[name_pattern] then
-		name_patterns[name_pattern] = { sink_function };
-	else
-		name_patterns[name_pattern][#name_patterns[name_pattern] + 1] = sink_function;
-	end
-end
-
 _M.new = make_logger;
 
 return _M;