util/logger.lua

changeset 716
d61eabc678a6
parent 615
4ae3e81513f3
child 758
b1885732e979
equal deleted inserted replaced
715:beec1eb7d9c6 716:d61eabc678a6
61 end 61 end
62 end 62 end
63 end 63 end
64 64
65 function setwriter(f) 65 function setwriter(f)
66 if not f then outfunction = nil; return true, nil; end 66 local old_func = outfunction;
67 if not f then outfunction = nil; return true, old_func; end
67 local ok, ret = pcall(f, "logger", "info", "Switched logging output successfully"); 68 local ok, ret = pcall(f, "logger", "info", "Switched logging output successfully");
68 if ok then 69 if ok then
69 outfunction = f; 70 outfunction = f;
71 ret = old_func;
70 end 72 end
71 return ok, ret; 73 return ok, ret;
72 end 74 end
73 75
74 return _M; 76 return _M;

mercurial