From 4b5c55d014c37e5b7538f7071053f608d25630c2 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期三, 24 四月 2024 11:20:45 +0800 Subject: [PATCH] 日志调整 --- log_module/log_export.py | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/log_module/log_export.py b/log_module/log_export.py index 795b12e..cda2700 100644 --- a/log_module/log_export.py +++ b/log_module/log_export.py @@ -149,6 +149,7 @@ pos_list = [] with open("{}/logs/gp/l2/l2_trade.{}.log".format(constant.get_path_prefix(), date), mode='r', encoding="utf-8") as f: + latest_single=[None, None] while True: line = f.readline() if not line: @@ -164,13 +165,20 @@ str_ = line.split("鑾峰彇鍒颁拱鍏ヤ俊鍙疯捣濮嬬偣锛�")[1].strip() index = str_[0:str_.find(" ")].strip() # print("淇″彿璧峰浣嶇疆锛�", index) - pos_list.append((0, int(index), "")) + latest_single = [None, None] + latest_single[0] = (0, int(index), "") elif line.find("鑾峰彇鍒颁拱鍏ユ墽琛屼綅缃�") > 0: str_ = line.split("鑾峰彇鍒颁拱鍏ユ墽琛屼綅缃細")[1].strip() index = str_[0:str_.find(" ")].strip() # print("涔板叆鎵ц浣嶇疆锛�", index) - pos_list.append((1, int(index), "")) + latest_single[1] = (1, int(index), "") + elif line.find("寮�濮嬫墽琛屼拱鍏�") > 0: + # 鍙湁鐪熸鎵ц涔板叆鎵嶄細璁板綍浣嶇疆 + for p in latest_single: + if p: + pos_list.append(p) + latest_single = [None,None] elif line.find("瑙﹀彂鎾ゅ崟锛屾挙鍗曚綅缃細") > 0: str_ = line.split("瑙﹀彂鎾ゅ崟锛屾挙鍗曚綅缃細")[1].strip() index = str_[0:str_.find(" ")].strip() -- Gitblit v1.8.0