| | |
| | | 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, |
| | | 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) |
| | |
| | | |
| | | 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 |
| | |
| | | fw.write(line) |
| | | finally: |
| | | fw.close() |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | # 导出数据处理位置日志 |
| | |
| | | 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: |
| | |
| | | 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: |
| | |
| | | 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: |
| | |
| | | |
| | | |
| | | 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") |