From ea007aa4297c0cab69d3ec7675aee66e51a3ca7e Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期一, 11 九月 2023 12:16:59 +0800 Subject: [PATCH] 系统日志添加保护 --- log_module/log_export.py | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/log_module/log_export.py b/log_module/log_export.py index f387fc1..8e14d41 100644 --- a/log_module/log_export.py +++ b/log_module/log_export.py @@ -333,12 +333,15 @@ lines = f.readlines() for line in lines: if line: - time_str = line.split("|")[0].strip() - level = line.split("|")[1].strip() - if level != "INFO" and level != "ERROR": - continue - data = line.split("|")[2].split(" - ")[1].strip() - fdatas.append((time_str, level, data)) + try: + time_str = line.split("|")[0].strip() + level = line.split("|")[1].strip() + if level != "INFO" and level != "ERROR": + continue + data = line.split("|")[2].split(" - ")[1].strip() + fdatas.append((time_str, level, data)) + except: + pass return fdatas -- Gitblit v1.8.0