util/logger: setwriter now returns the old writer on success
authorWaqas Hussain <waqas20@gmail.com>
Wed, 14 Jan 2009 18:04:16 +0000 (23:04 +0500)
committerWaqas Hussain <waqas20@gmail.com>
Wed, 14 Jan 2009 18:04:16 +0000 (23:04 +0500)
util/logger.lua

index 5115bbdaaeadc545fe2b2ef0a93b4e205911e721..bbc783d497e09b2ea48bb16c326146e861a87a91 100644 (file)
@@ -63,10 +63,12 @@ function init(name)
 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