Add date and time to log module modified: listfix/log.py
Brian Barto bartobrian@gmail.com
Fri, 01 Apr 2022 16:05:21 -0400
1 files changed,
4 insertions(+),
1 deletions(-)
jump to
M
listfix/log.py
→
listfix/log.py
@@ -1,3 +1,5 @@
+from datetime import datetime + class Log: def __init__(self):@@ -5,8 +7,9 @@ self.log_file = "/tmp/listfix_log.txt"
def write(self, type, txt): txt = txt.rstrip() + date = datetime.now() f = open(self.log_file, "a") - f.write(f"[{type}] {txt}\n") + f.write(f"[{type}] {date}, {txt}\n") f.close() def info(self, txt):