fix 7-8 recall and better log
This commit is contained in:
@@ -3090,16 +3090,17 @@ static void getDirectoryFilesInfo(const std::string &dirPath, std::vector<FileIn
|
||||
}
|
||||
|
||||
// 将 JSON 字符串写入指定文件
|
||||
static void writeJsonToFile(const char* filePath, const char* jsonString)
|
||||
static bool writeJsonToFile(const char* filePath, const char* jsonString)
|
||||
{
|
||||
FILE* fp = fopen(filePath, "w");
|
||||
if (!fp) {
|
||||
DIY_ERRORLOG_CODE("process",LOG_CODE_TRANSIENT_COMM,"【ERROR】无法将暂态事件写入本地缓存");
|
||||
//DIY_ERRORLOG_CODE("process",LOG_CODE_TRANSIENT_COMM,"【ERROR】无法将暂态事件写入本地缓存");
|
||||
std::cerr << "Failed to write in file : " << filePath << std::endl;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
fprintf(fp, "%s", jsonString);
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 检查 qvvr 目录下文件总大小,若超过 10M 则删除最老的一个文件
|
||||
@@ -3344,7 +3345,9 @@ char* mp_id,char* Qvvr_rptname,char* devtype)
|
||||
fileName += ".txt";
|
||||
|
||||
// 把 json_string 写入文件
|
||||
writeJsonToFile(fileName.c_str(), json_string);
|
||||
if(!writeJsonToFile(fileName.c_str(), json_string)){
|
||||
DIY_ERRORLOG_CODE(full_key_m_d,LOG_CODE_TRANSIENT_COMM,"【ERROR】监测点:%s无法将暂态时间为%lld的暂态事件写入本地缓存",start_tm,mp_id);
|
||||
}
|
||||
|
||||
checkAndRemoveOldestIfNeeded(qvvrDir, 10LL * 1024 * 1024);
|
||||
}
|
||||
@@ -3390,7 +3393,9 @@ char* mp_id,char* Qvvr_rptname,char* devtype)
|
||||
fileName += buf;
|
||||
fileName += ".txt";
|
||||
// 把 json_string 写入文件
|
||||
writeJsonToFile(fileName.c_str(), json_string);
|
||||
if(!writeJsonToFile(fileName.c_str(), json_string)){
|
||||
DIY_ERRORLOG_CODE(full_key_m_d,LOG_CODE_TRANSIENT_COMM,"【ERROR】监测点:%s无法将暂态时间为%lld的暂态事件写入本地缓存",start_tm,mp_id);
|
||||
}
|
||||
|
||||
checkAndRemoveOldestIfNeeded(qvvrDir, 10LL * 1024 * 1024);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user