prepare filtering

This commit is contained in:
2021-10-26 18:51:32 +02:00
parent 1a67925873
commit f9434b4c1d
8 changed files with 90 additions and 20 deletions

View File

@@ -9,7 +9,8 @@ from settings import Settings
class LogFileModel:
_lock = threading.RLock()
def __init__(self, file):
def __init__(self, file:str, settings: Settings):
self.settings = settings
self._file = os.path.realpath(file)
def get_file(self):
@@ -43,7 +44,7 @@ class LogFileModel:
# TODO handle lines longer than 4096 bytes
with open(self._file, 'rb') as f:
offset = min(byte_offset, self.byte_count())
offset = max(0, offset - Settings.max_line_length())
offset = max(0, offset - self.settings.max_line_length())
#print("offset: %s" % (offset))