filtering without auto refresh

This commit is contained in:
2021-10-27 08:05:18 +02:00
parent f9434b4c1d
commit 28d3775b94
2 changed files with 75 additions and 6 deletions

View File

@@ -74,4 +74,15 @@ class LogFileModel:
return result
def byte_count(self) -> int:
return os.stat(self._file).st_size
return os.stat(self._file).st_size
def write_line(self, line: str):
with open(self._file, 'a+b') as f:
f.write(line.encode("utf8"))
if not line.endswith("\n"):
f.write("\n".encode("utf8"))
def truncate(self):
with open(self._file, 'a') as f:
print("truncating")
f.truncate(0)