Skip to content

Commit a189643

Browse files
committed
update log parser
1 parent 564a00b commit a189643

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

utils/onboarding/injection_log_parser.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,26 @@ def _get_process_logs_from_log_file(log_local_path: str, line_filter: Callable):
7272
\"injector finished\" (or the next \"process_exe:\"). This includes WLS decision
7373
lines and post-WLS lines like \"No known runtime was detected - not injecting!\".
7474
"""
75-
injector_finished = "injector finished"
76-
current: list[str] = []
75+
process_logs = []
7776
with open(log_local_path, encoding="utf-8") as f:
7877
for line in f:
7978
if not line_filter(line):
8079
continue
8180
if "process_exe:" in line:
82-
if current:
83-
yield current.copy()
84-
current = [line]
81+
if process_logs:
82+
yield process_logs.copy()
83+
process_logs = [line]
8584
continue
86-
if injector_finished in line:
87-
if current:
88-
current.append(line)
89-
yield current.copy()
90-
current = []
85+
if process_logs and (WLS_ALLOWED_INJECTION in line or WLS_DENIED_INJECTION in line):
86+
process_logs.append(line)
87+
yield process_logs.copy()
88+
process_logs = []
89+
continue
90+
if "injector finished" in line:
91+
process_logs.append(line)
92+
yield process_logs.copy()
93+
process_logs = []
9194
continue
92-
if current:
93-
current.append(line)
9495

9596

9697
def main():

0 commit comments

Comments
 (0)