util/logger: setwriter now returns the old writer on success

Wed, 14 Jan 2009 23:04:16 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Wed, 14 Jan 2009 23:04:16 +0500
changeset 716
d61eabc678a6
parent 715
beec1eb7d9c6
child 717
ab428c579cbc

util/logger: setwriter now returns the old writer on success

util/logger.lua file | annotate | diff | comparison | revisions
--- a/util/logger.lua	Wed Jan 14 22:35:01 2009 +0500
+++ b/util/logger.lua	Wed Jan 14 23:04:16 2009 +0500
@@ -63,10 +63,12 @@
 end
 
 function setwriter(f)
-	if not f then outfunction = nil; return true, nil; end
+	local old_func = outfunction;
+	if not f then outfunction = nil; return true, old_func; end
 	local ok, ret = pcall(f, "logger", "info", "Switched logging output successfully");
 	if ok then
 		outfunction = f;
+		ret = old_func;
 	end
 	return ok, ret;
 end

mercurial