commit 78478d1f634efb94105a68997428ab7ea840c2d0
parent 8707f299e5393148e19d336d6f4a2a501c2e610c
Author: parazyd <parazyd@dyne.org>
Date: Mon, 6 Nov 2017 12:46:00 +0100
improve log redo
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/log.py b/lib/log.py
@@ -49,8 +49,9 @@ def logtofile(filename, text, redo=False):
If redo is True, rewrites the file
"""
makedirs(logdir, exist_ok=True)
+ wrt = 'a'
if redo:
- remove(join(logdir, filename))
- lfile = open(join(logdir, filename), 'a')
+ wrt = 'w'
+ lfile = open(join(logdir, filename), wrt)
lfile.write(text)
lfile.close()