From ddd49deef7ac6daff95086f112a0061a641c4fe3 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期四, 13 六月 2024 15:36:00 +0800 Subject: [PATCH] 添加订阅日志 --- log_module/log_export.py | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 deletions(-) diff --git a/log_module/log_export.py b/log_module/log_export.py index 2696945..a45f3ac 100644 --- a/log_module/log_export.py +++ b/log_module/log_export.py @@ -124,7 +124,7 @@ date = datetime.datetime.now().strftime("%Y-%m-%d") pos_list = [] path_ = "{}/logs/gp/l2/l2_process.{}.log".format(constant.get_path_prefix(), date) - if os.path.exists(path_): + try: with open(path_, mode='r', encoding="utf-8") as f: while True: @@ -141,6 +141,8 @@ pos_list.append((int(line.split("-")[0]), int(line.split("-")[1]))) except Exception as e: logging.exception(e) + except: + pass return pos_list @@ -626,6 +628,23 @@ return fdatas +def load_huaxin_order_detail(date=tool.get_now_date_str()): + """ + 鍔犺浇L2閫愮瑪濮旀墭鏁版嵁 + @param date: + @return: + """ + fdatas = [] + path = f"{constant.get_path_prefix()}/logs/huaxin/l2/orderdetail.{date}.log" + lines = __load_file_content(path) + for line in lines: + if line: + time = __get_async_log_time(line) + line = line[line.rfind("#") + 1:] + fdatas.append((time, eval(line))) + return fdatas + + def load_pre_close_price(date=tool.get_now_date_str()): """ 鍔犺浇涔嬪墠鐨勬敹鐩樹环 -- Gitblit v1.8.0