- file deleter: improved logging; from Oliver

svn path=/trunk/boinc/; revision=25050
This commit is contained in:
David Anderson 2012-01-13 23:39:14 +00:00
parent ec40a74531
commit 46fb7bd97a
2 changed files with 35 additions and 26 deletions

View File

@ -490,3 +490,9 @@ Rom 13 Jan 2012
clientgui/ clientgui/
MainDocument.cpp MainDocument.cpp
David 13 Jan 2012
- file deleter: improved logging; from Oliver
sched/
file_deleter.cpp

View File

@ -143,7 +143,7 @@ int wu_delete_files(WORKUNIT& wu) {
char* p; char* p;
char filename[256], pathname[256], buf[BLOB_SIZE]; char filename[256], pathname[256], buf[BLOB_SIZE];
bool no_delete=false; bool no_delete=false;
int count_deleted = 0, retval, mthd_retval = 0; int count_deleted = 0, count_deleted_md5 = 0, retval, mthd_retval = 0;
if (strstr(wu.name, "nodelete")) return 0; if (strstr(wu.name, "nodelete")) return 0;
@ -167,7 +167,7 @@ int wu_delete_files(WORKUNIT& wu) {
if (retval == ERR_OPENDIR) { if (retval == ERR_OPENDIR) {
log_messages.printf(MSG_CRITICAL, log_messages.printf(MSG_CRITICAL,
"[WU#%d] missing dir for %s\n", "[WU#%d] missing dir for %s\n",
wu.id, filename wu.id, pathname
); );
mthd_retval = ERR_UNLINK; mthd_retval = ERR_UNLINK;
} else if (retval) { } else if (retval) {
@ -176,14 +176,14 @@ int wu_delete_files(WORKUNIT& wu) {
wu.id, filename, boincerror(retval) wu.id, filename, boincerror(retval)
); );
} else { } else {
log_messages.printf(MSG_NORMAL, log_messages.printf(MSG_DEBUG,
"[WU#%d] deleting %s\n", wu.id, filename "[WU#%d] deleting %s\n", wu.id, pathname
); );
retval = unlink(pathname); retval = unlink(pathname);
if (retval) { if (retval) {
log_messages.printf(MSG_CRITICAL, log_messages.printf(MSG_CRITICAL,
"[WU#%d] unlink %s failed: %s\n", "[WU#%d] unlink %s failed: %s\n",
wu.id, filename, boincerror(retval) wu.id, pathname, boincerror(retval)
); );
mthd_retval = ERR_UNLINK; mthd_retval = ERR_UNLINK;
} else { } else {
@ -193,15 +193,17 @@ int wu_delete_files(WORKUNIT& wu) {
// //
if (config.cache_md5_info) { if (config.cache_md5_info) {
strcat(pathname,".md5"); strcat(pathname,".md5");
log_messages.printf(MSG_NORMAL, log_messages.printf(MSG_DEBUG,
"[WU#%d] deleting %s\n", wu.id, filename "[WU#%d] deleting %s\n", wu.id, pathname
); );
retval = unlink(pathname); retval = unlink(pathname);
if (retval) { if (retval) {
log_messages.printf(MSG_CRITICAL, log_messages.printf(MSG_CRITICAL,
"[WU#%d] unlink %s failed: %s\n", "[WU#%d] unlink %s failed: %s\n",
wu.id, filename, boincerror(retval) wu.id, pathname, boincerror(retval)
); );
} else {
count_deleted_md5++;
} }
} }
} }
@ -209,8 +211,9 @@ int wu_delete_files(WORKUNIT& wu) {
} }
p = strtok(0, "\n"); p = strtok(0, "\n");
} }
log_messages.printf(MSG_DEBUG, log_messages.printf(MSG_NORMAL,
"[WU#%d] deleted %d file(s)\n", wu.id, count_deleted "[WU#%d] deleted %d input files and %d cached md5 files\n",
wu.id, count_deleted, count_deleted_md5
); );
return mthd_retval; return mthd_retval;
} }
@ -269,7 +272,7 @@ int result_delete_files(RESULT& result) {
); );
} else { } else {
count_deleted++; count_deleted++;
log_messages.printf(MSG_NORMAL, log_messages.printf(MSG_DEBUG,
"[RESULT#%d] unlinked %s\n", result.id, pathname "[RESULT#%d] unlinked %s\n", result.id, pathname
); );
} }
@ -279,8 +282,8 @@ int result_delete_files(RESULT& result) {
p = strtok(0, "\n"); p = strtok(0, "\n");
} }
log_messages.printf(MSG_DEBUG, log_messages.printf(MSG_NORMAL,
"[RESULT#%d] deleted %d file(s)\n", result.id, count_deleted "[RESULT#%d] deleted %d output file(s)\n", result.id, count_deleted
); );
return mthd_retval; return mthd_retval;
} }