modify log
This commit is contained in:
@@ -195,7 +195,7 @@ void handleUploadResponse(const std::string& response, std::string& wavepath) {
|
||||
wavepath = nameWithoutExt;
|
||||
|
||||
std::cout << "wavepath: " << wavepath << std::endl;
|
||||
DIY_INFOLOG_CODE("process",0,LOG_CODE_FILE, "前置上传文件成功,远端文件名:%s", wavepath.c_str());
|
||||
DIY_INFOLOG_CODE("process",0,LOG_CODE_FILE, "上传文件成功,远端文件名:%s", wavepath.c_str());
|
||||
}
|
||||
|
||||
//上传文件
|
||||
@@ -710,7 +710,7 @@ int parse_device_cfg_web()
|
||||
input_jstr += "}";
|
||||
|
||||
std::cout << "input_jstr: " << input_jstr << std::endl;
|
||||
DIY_DEBUGLOG_CODE("process",0,LOG_CODE_LEDGER,"前置获取台账使用的请求输入为:%s", input_jstr.c_str());
|
||||
DIY_DEBUGLOG_CODE("process",0,LOG_CODE_LEDGER,"台账接口输入:%s", input_jstr.c_str());
|
||||
|
||||
// 2. 调用接口
|
||||
std::map<std::string, terminal_dev> terminal_dev_map;
|
||||
@@ -750,7 +750,7 @@ int parse_device_cfg_web()
|
||||
// 5. 台账数量与配置比对
|
||||
int count_cfg = static_cast<int>(terminal_dev_map.size());
|
||||
std::cout << "terminal_ledger_num: " << count_cfg << std::endl;
|
||||
DIY_DEBUGLOG_CODE("process",0,LOG_CODE_LEDGER,"前置获取到的台账的数量为:%d",count_cfg);
|
||||
DIY_DEBUGLOG_CODE("process",0,LOG_CODE_LEDGER,"获取到台账数量:%d",count_cfg);
|
||||
|
||||
if (IED_COUNT < count_cfg) {
|
||||
std::cout << "!!!!!!!!!!single process has ledger count more than config!!!!!!!" << std::endl;
|
||||
@@ -808,7 +808,7 @@ int parse_device_cfg_web()
|
||||
if (!mon.terminal_connect.empty() && mon.terminal_connect != "0") {
|
||||
isdelta_flag = 1;
|
||||
std::cout << "monitor_id " << mon.monitor_id<< " v_wiring_type: " << mon.terminal_connect << " is delta wiring: " << isdelta_flag << std::endl;
|
||||
DIY_WARNLOG_CODE("process",0,LOG_CODE_WIRETYPE,"装置:%s - 监测点: %s 是角形接线",dev.terminal_name.c_str(),mon.monitor_name.c_str());
|
||||
//DIY_WARNLOG_CODE("process",0,LOG_CODE_WIRETYPE,"装置:%s - 监测点: %s 是角形接线",dev.terminal_name.c_str(),mon.monitor_name.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1055,7 +1055,7 @@ static void writeJsonToFile(const std::string& filePath, const std::string& json
|
||||
{
|
||||
FILE* fp = fopen(filePath.c_str(), "w");
|
||||
if (!fp) {
|
||||
DIY_ERRORLOG_CODE("process",0,LOG_CODE_TRANSIENT_COMM, "前置无法将暂态事件写入本地缓存");
|
||||
DIY_ERRORLOG_CODE("process",0,LOG_CODE_TRANSIENT_COMM, "无法将暂态事件写入本地缓存,暂态事件保存失败");
|
||||
std::cerr << "Failed to write in file : " << filePath << std::endl;
|
||||
return;
|
||||
}
|
||||
@@ -1167,7 +1167,7 @@ static void scanAndResendOfflineFiles(const std::string& dirPath)
|
||||
// 读取 JSON 文件内容
|
||||
std::ifstream inFile(file.fileName.c_str());
|
||||
if (!inFile) {
|
||||
DIY_ERRORLOG_CODE("process",0,LOG_CODE_TRANSIENT_COMM, "无法打开本地缓存的暂态事件");
|
||||
DIY_ERRORLOG_CODE("process",0,LOG_CODE_TRANSIENT_COMM, "无法打开本地缓存的暂态事件,暂态事件重发失败");
|
||||
std::cerr << "fail to open existing file: " << file.fileName << std::endl;
|
||||
continue;
|
||||
}
|
||||
@@ -1186,14 +1186,14 @@ static void scanAndResendOfflineFiles(const std::string& dirPath)
|
||||
try {
|
||||
json j_r = json::parse(response);
|
||||
|
||||
DIY_WARNLOG_CODE("process",0,LOG_CODE_TRANSIENT_COMM, "前置重发暂态事件成功");
|
||||
DIY_WARNLOG_CODE("process",0,LOG_CODE_TRANSIENT_COMM, "重发暂态事件成功");
|
||||
std::cout << "old file send success, remove it" << std::endl;
|
||||
|
||||
std::remove(file.fileName.c_str());
|
||||
} catch (...) {
|
||||
std::cout << "old file send fail (response parse failed)" << std::endl;
|
||||
|
||||
DIY_ERRORLOG_CODE("process",0,LOG_CODE_TRANSIENT_COMM, "前置重发暂态事件失败");
|
||||
DIY_ERRORLOG_CODE("process",0,LOG_CODE_TRANSIENT_COMM, "暂态接口响应异常,重发暂态事件失败");
|
||||
handleCommentResponse(response); // 仍然处理文本响应
|
||||
}
|
||||
} else {
|
||||
@@ -1294,15 +1294,7 @@ int transfer_json_qvvr_data(const std::string& dev_id, ushort monitor_id,
|
||||
&& j_r["code"].is_string()
|
||||
&& j_r["code"].get<std::string>() != "0") {
|
||||
|
||||
DIY_ERRORLOG_CODE(
|
||||
mpid.c_str(),
|
||||
2,
|
||||
LOG_CODE_TRANSIENT_COMM,
|
||||
"暂态接口业务失败(code=%s),无法上送装置%s - 监测点%s的暂态事件",
|
||||
j_r["code"].get<std::string>().c_str(),
|
||||
showName_d,
|
||||
showName_m
|
||||
);
|
||||
DIY_ERRORLOG_CODE(mpid.c_str(),2,LOG_CODE_TRANSIENT_COMM,"暂态接口业务失败(code=%s),无法上送暂态事件",j_r["code"].get<std::string>().c_str());
|
||||
|
||||
std::cout << "qvvr send fail ,store in local" << std::endl;
|
||||
std::string qvvrDir = FRONT_PATH + "/dat/qvvr/";
|
||||
@@ -1318,7 +1310,7 @@ int transfer_json_qvvr_data(const std::string& dev_id, ushort monitor_id,
|
||||
|
||||
} catch (...) {
|
||||
// 响应异常,保存 json
|
||||
DIY_ERRORLOG_CODE(mpid.c_str(),2,LOG_CODE_TRANSIENT_COMM, "暂态接口响应异常,无法上送装置%s - 监测点%s的暂态事件",showName_d, showName_m);
|
||||
DIY_ERRORLOG_CODE(mpid.c_str(),2,LOG_CODE_JSON, "暂态接口响应异常,无法上送暂态事件");
|
||||
|
||||
std::cout << "qvvr send fail ,store in local" << std::endl;
|
||||
std::string qvvrDir = FRONT_PATH + "/dat/qvvr/";
|
||||
@@ -1328,7 +1320,7 @@ int transfer_json_qvvr_data(const std::string& dev_id, ushort monitor_id,
|
||||
}
|
||||
} else {
|
||||
// 无响应,保存 json
|
||||
DIY_ERRORLOG_CODE(mpid.c_str(),2,LOG_CODE_TRANSIENT_COMM,"暂态接口无响应,无法上送装置%s - 监测点%s的暂态事件",showName_d, showName_m);
|
||||
DIY_ERRORLOG_CODE(mpid.c_str(),2,LOG_CODE_TRANSIENT_COMM,"暂态接口无响应,无法上送暂态事件");
|
||||
|
||||
std::cout << "qvvr send fail ,store in local" << std::endl;
|
||||
std::string qvvrDir = FRONT_PATH + "/dat/qvvr/";
|
||||
|
||||
Reference in New Issue
Block a user