log optimize

This commit is contained in:
lnk
2025-05-30 15:40:20 +08:00
parent 8d3ec192e8
commit a33418113a
6 changed files with 106 additions and 52 deletions

View File

@@ -4470,7 +4470,10 @@ int parse_model_cfg_web()
}
/////////////////////////////////////////////////////////////////////////
parse_model_web(&icd_model_map,codes);
if(parse_model_web(&icd_model_map,codes)){
DIY_ERRORLOG("process","【ERROR】前置的%s%d号进程 icd模型接口异常,将使用默认的icd模型,请检查接口配置", get_front_msg_from_subdir(), g_front_seg_index);
return APR_SUCCESS; //可以使用默认的映射文件所以返回正常
}
codes.clear();
@@ -4723,6 +4726,7 @@ int recall_json_handle(const char* jstr)
if(strcmp(ied_usr->LD_info[m].mp_id,monitorId.toStdString().c_str()) == 0){//匹配上了
DIY_INFOLOG("process","【NORMAL】前置的%s%d号进程处理监测点%s -id:%s 的数据补招",get_front_msg_from_subdir(), g_front_seg_index,ied_usr->LD_info[m].name,ied_usr->LD_info[m].mp_id);
mppair = 1;
break;//找到就退出监测点循环
}
@@ -4945,6 +4949,7 @@ void handleUploadResponse(const std::string& response, char* wavepath) {
cJSON* json_data = cJSON_Parse(response.c_str());
if (json_data == nullptr) {
std::cerr << "Error parsing response: " << cJSON_GetErrorPtr() << std::endl;
DIY_ERRORLOG("process","【ERROR】前置上传暂态录波文件失败,web返回的消息不是json格式");
return;
}
@@ -4989,9 +4994,12 @@ void handleUploadResponse(const std::string& response, char* wavepath) {
strcpy(wavepath, nameWithoutExt.c_str());
std::cout << "wavepath: " << wavepath << std::endl;
DIY_INFOLOG("process","【NORMAL】前置上传暂态录波文件成功,远端文件名:%s",wavepath);
}
} else {
std::cerr << "Error: Missing expected fields in JSON response." << std::endl;
DIY_ERRORLOG("process","【ERROR】前置上传暂态录波文件失败,web返回的消息没有远端文件名");
}
// 释放 JSON 对象
@@ -5108,6 +5116,7 @@ void SendFileWeb(const std::string& strUrl, const char* localpath, const char* c
CURLcode res = curl_easy_perform(curl);
if (res != CURLE_OK) {
std::cerr << "http web failed: " << curl_easy_strerror(res) << std::endl;
DIY_ERRORLOG("process","【ERROR】前置上传暂态录波文件 %s 失败,请检查文件上传接口配置",localpath);
} else {
std::cout << "http web success, response: " << resPost0 << std::endl;
handleUploadResponse(resPost0, wavepath); // 处理响应