From 52df657af23a34b8ff75d62401ebf7962c6fb378 Mon Sep 17 00:00:00 2001 From: Pelagic Date: Sat, 16 Dec 2023 07:43:31 +0200 Subject: [PATCH] Added another lifecycle hook with which to reset the persistent status of the parser. --- starfields_logparser/base_parsers.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/starfields_logparser/base_parsers.py b/starfields_logparser/base_parsers.py index e2070d2..d68ea95 100644 --- a/starfields_logparser/base_parsers.py +++ b/starfields_logparser/base_parsers.py @@ -18,6 +18,7 @@ class BaseOrderedLogParser: line = file.readline() new_flag = False + break_condition = True while (line): # Only check for a new line if we're not at new entries yet if not new_flag: @@ -34,7 +35,10 @@ class BaseOrderedLogParser: self.aggregators_deinit(file, aggregates, status) - self.update_status(aggregates, status) + if not break_condition: + self.reset_status(aggregates, status) + else: + self.update_status(aggregates, status) def get_context_manager(self): """ @@ -52,6 +56,12 @@ class BaseOrderedLogParser: """ pass + def reset_status(self, aggregates, status): + """ + Resets the saved status of the parser. + """ + pass + def update_status(self, aggregates, status): """ Updates the saved status of the parser.