diff options
author | mranzinger <mikeranzinger@gmail.com> | 2015-10-22 00:45:14 +0300 |
---|---|---|
committer | mranzinger <mikeranzinger@gmail.com> | 2015-10-22 00:45:14 +0300 |
commit | 75a79a7f76ee446cfc69097e0b5aca0602140346 (patch) | |
tree | 6a939db28d205e771df31718fd1f654dc070b913 | |
parent | 91a786b830ccf4004a8d0162653ab782dd25c1a1 (diff) |
Update init.lua
Allowing the logfile to be appended to instead of just overwritten.
-rw-r--r-- | init.lua | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -109,9 +109,11 @@ rawset(_G, 'xprint', xlua.print) ---------------------------------------------------------------------- -- log all session, by replicating stdout to a file ---------------------------------------------------------------------- -function xlua.log(file) +function xlua.log(file, append) os.execute('mkdir ' .. (sys.uname() ~= 'windows' and '-p ' or '') .. ' "' .. sys.dirname(file) .. '"') - local f = assert(io.open(file,'w')) + local mode = 'w' + if append then mode = 'a' end + local f = assert(io.open(file,mode)) io._write = io.write _G._print = _G.print _G.print = xlua.print @@ -713,4 +715,4 @@ function string.tosymbol(str) end end -return xlua
\ No newline at end of file +return xlua |