From b4ff4ac715060ce313cdaee2345617b4b7a979ea Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期一, 08 一月 2024 16:19:58 +0800 Subject: [PATCH] bug修复/日志添加 --- data_server.py | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-) diff --git a/data_server.py b/data_server.py index 39ea3d4..1308eec 100644 --- a/data_server.py +++ b/data_server.py @@ -6,6 +6,7 @@ import dask +import log from code_attribute import gpcode_manager from log import logger_request_debug from log_module import log_analyse, log_export @@ -44,10 +45,10 @@ KPLLimitUpDataRecordManager.load_total_datas() total_datas = KPLLimitUpDataRecordManager.total_datas - current_datas_results = hosting_api_util.common_request({"ctype":"get_kpl_limit_up_datas"}) + current_datas_results = hosting_api_util.common_request({"ctype": "get_kpl_limit_up_datas"}) if type(current_datas_results) == str: current_datas_results = json.loads(current_datas_results) - current_datas = current_datas_results.get("data") #KPLLimitUpDataRecordManager.latest_origin_datas + current_datas = current_datas_results.get("data") # KPLLimitUpDataRecordManager.latest_origin_datas current_block_codes = {} for c in current_datas: if c[5] not in current_block_codes: @@ -272,8 +273,7 @@ def do_GET(self): path = self.path url = urlparse.urlparse(path) - thread_id = random.randint(0, 1000000) - logger_request_debug.info(f"GET 璇锋眰寮�濮�({thread_id})锛歿url.path}") + log.request_info("DATA_SERVER_GET", f"GET 璇锋眰寮�濮嬶細{url.path}") try: if url.path == "/kpl/get_limit_up_list": response_data = self.__get_limit_up_list() @@ -287,14 +287,12 @@ result = hosting_api_util.get_from_data_server(url.path, ps_dict) self.__send_response(result) finally: - logger_request_debug.info(f"GET 璇锋眰缁撴潫({thread_id})锛歿url.path}") - + log.request_info("DATA_SERVER_GET", f"GET 璇锋眰缁撴潫") def do_POST(self): - thread_id = random.randint(0, 1000000) path = self.path url = urlparse.urlparse(path) - logger_request_debug.info(f"POST 璇锋眰寮�濮�({thread_id})锛歿url.path}") + log.request_info("DATA_SERVER_POST", f"POST 璇锋眰寮�濮嬶細{url.path}") try: if url.path == "/upload_kpl_data": # 鎺ュ彈寮�鐩樺暒鏁版嵁 @@ -302,7 +300,7 @@ result_str = self.__process_kpl_data(params) self.__send_response(result_str) finally: - logger_request_debug.info(f"POST 璇锋眰缁撴潫({thread_id})锛歿url.path}") + log.request_info("DATA_SERVER_POST", f"POST 璇锋眰缁撴潫") def __process_kpl_data(self, data): data = json.loads(json.dumps(data).replace("姒傚康", "")) -- Gitblit v1.8.0