mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-10 21:46:55 +03:00
rotation of image log files implemented
improved rotation of message log files implement deletion of temp images before start new flow a little bit code cleaning
This commit is contained in:
@@ -94,7 +94,7 @@ void ClassLogFile::RemoveOld()
|
||||
|
||||
DIR *dir = opendir(logroot.c_str());
|
||||
if (!dir) {
|
||||
ESP_LOGE(TAG, "Failed to stat dir : %s", logroot.c_str());
|
||||
ESP_LOGI(TAG, "Failed to stat dir : %s", logroot.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -103,9 +103,9 @@ void ClassLogFile::RemoveOld()
|
||||
int notDeleted = 0;
|
||||
while ((entry = readdir(dir)) != NULL) {
|
||||
if (entry->d_type == DT_REG) {
|
||||
//ESP_LOGE(TAG, "list log file : %s", entry->d_name);
|
||||
//ESP_LOGI(TAG, "list log file : %s %s", entry->d_name, cmpfilename);
|
||||
if ((strlen(entry->d_name) == strlen(cmpfilename)) && (strcmp(entry->d_name, cmpfilename) < 0)) {
|
||||
ESP_LOGE(TAG, "delete log file : %s", entry->d_name);
|
||||
ESP_LOGI(TAG, "delete log file : %s", entry->d_name);
|
||||
std::string filepath = logroot + "/" + entry->d_name;
|
||||
if (unlink(filepath.c_str()) == 0) {
|
||||
deleted ++;
|
||||
@@ -117,7 +117,7 @@ void ClassLogFile::RemoveOld()
|
||||
}
|
||||
}
|
||||
}
|
||||
ESP_LOGE(TAG, "%d older log files deleted. %d current log files not deleted.", deleted, notDeleted);
|
||||
ESP_LOGI(TAG, "%d older log files deleted. %d current log files not deleted.", deleted, notDeleted);
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user