From ad69cf29b884f99b1e22f383644cd706f392753d Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期一, 10 七月 2023 17:00:40 +0800
Subject: [PATCH] 华鑫适配

---
 log_module/log.py |   54 +++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 45 insertions(+), 9 deletions(-)

diff --git a/log_module/log.py b/log_module/log.py
index 5288ea6..744f145 100644
--- a/log_module/log.py
+++ b/log_module/log.py
@@ -163,9 +163,36 @@
                    filter=lambda record: record["extra"].get("name") == "kp_msg",
                    rotation="00:00", compression="zip", enqueue=True)
 
+        ################################鍗庨懌鏃ュ織################################
+        logger.add(self.get_hx_path("l2", "transaction"),
+                   filter=lambda record: record["extra"].get("name") == "hx_l2_transaction",
+                   rotation="00:00", compression="zip", enqueue=True)
+        logger.add(self.get_hx_path("l2", "orderdetail"),
+                   filter=lambda record: record["extra"].get("name") == "hx_l2_orderdetail",
+                   rotation="00:00", compression="zip", enqueue=True)
+        logger.add(self.get_hx_path("l2", "upload"),
+                   filter=lambda record: record["extra"].get("name") == "hx_l2_upload",
+                   rotation="00:00", compression="zip", enqueue=True)
+        logger.add(self.get_hx_path("contact", "debug"),
+                   filter=lambda record: record["extra"].get("name") == "hx_contact_debug",
+                   rotation="00:00", compression="zip", enqueue=True)
+        logger.add(self.get_hx_path("trade", "trade_callback"),
+                   filter=lambda record: record["extra"].get("name") == "hx_trade_callback",
+                   rotation="00:00", compression="zip", enqueue=True)
+        logger.add(self.get_hx_path("trade", "debug"),
+                   filter=lambda record: record["extra"].get("name") == "hx_trade_debug",
+                   rotation="00:00", compression="zip", enqueue=True)
+
     def get_path(self, dir_name, log_name):
-        return "{}/logs/gp/{}/{}".format(constant.get_path_prefix(), dir_name,
-                                         log_name) + ".{time:YYYY-MM-DD}.log"
+        path_str = "{}/logs/gp/{}/{}".format(constant.get_path_prefix(), dir_name, log_name) + ".{time:YYYY-MM-DD}.log"
+        # print(path_str)
+        return path_str
+
+    def get_hx_path(self, dir_name, log_name):
+        path_str = "{}/logs/huaxin/{}/{}".format(constant.get_path_prefix(), dir_name,
+                                                 log_name) + ".{time:YYYY-MM-DD}.log"
+        # print(path_str)
+        return path_str
 
     def get_logger(self, log_name):
         return logger.bind(name=log_name)
@@ -227,6 +254,14 @@
 
 logger_kp_msg = __mylogger.get_logger("kp_msg")
 
+# -------------------------------鍗庨懌鏃ュ織---------------------------------
+hx_logger_l2_orderdetail = __mylogger.get_logger("hx_l2_orderdetail")
+hx_logger_l2_transaction = __mylogger.get_logger("hx_l2_transaction")
+hx_logger_l2_upload = __mylogger.get_logger("hx_l2_upload")
+hx_logger_contact_debug = __mylogger.get_logger("hx_contact_debug")
+hx_logger_trade_callback = __mylogger.get_logger("hx_trade_callback")
+hx_logger_trade_debug = __mylogger.get_logger("hx_trade_debug")
+
 
 class LogUtil:
     @classmethod
@@ -240,9 +275,6 @@
                         fw.write(line)
         finally:
             fw.close()
-
-
-
 
 
 # 瀵煎嚭鏁版嵁澶勭悊浣嶇疆鏃ュ織
@@ -335,7 +367,8 @@
     if not date:
         date = datetime.datetime.now().strftime("%Y-%m-%d")
     pos_list = []
-    with open("{}/logs/gp/l2/l2_process.{}.log".format(constant.get_path_prefix(), date), mode='r', encoding="utf-8") as f:
+    with open("{}/logs/gp/l2/l2_process.{}.log".format(constant.get_path_prefix(), date), mode='r',
+              encoding="utf-8") as f:
         while True:
             line = f.readline()
             if not line:
@@ -355,7 +388,8 @@
     if not date:
         date = datetime.datetime.now().strftime("%Y-%m-%d")
     pos_list = []
-    with open("{}/logs/gp/l2/l2_trade.{}.log".format(constant.get_path_prefix(), date), mode='r', encoding="utf-8") as f:
+    with open("{}/logs/gp/l2/l2_trade.{}.log".format(constant.get_path_prefix(), date), mode='r',
+              encoding="utf-8") as f:
         while True:
             line = f.readline()
             if not line:
@@ -395,7 +429,8 @@
         date = datetime.datetime.now().strftime("%Y-%m-%d")
     index_list = []
     buy_queues = []
-    with open("{}/logs/gp/l2/l2_trade_buy_queue.{}.log".format(constant.get_path_prefix(),date), mode='r', encoding="utf-8") as f:
+    with open("{}/logs/gp/l2/l2_trade_buy_queue.{}.log".format(constant.get_path_prefix(), date), mode='r',
+              encoding="utf-8") as f:
         while True:
             line = f.readline()
             if not line:
@@ -526,7 +561,8 @@
 
 
 if __name__ == '__main__':
-    print(get_h_cancel_compute_info("603912"))
+    logger_l2_process_time.info("test123")
+    # print(get_h_cancel_compute_info("603912"))
 
     # logger_l2_h_cancel.info("test")
     # logger_l2_process_time.info("test123")

--
Gitblit v1.8.0