simplified the path in the log (#910)

This commit is contained in:
fengdaolong 2021-12-25 03:56:35 +08:00 committed by GitHub
parent bc4789ae0e
commit 2378ea0be2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -148,8 +148,9 @@ void traceEvent (int eventTraceLevel, char* file, int line, char * format, ...)
snprintf(out_buf, sizeof(out_buf), "%s%s", extra_msg, buf);
syslog(LOG_INFO, "%s", out_buf);
} else {
#endif
for(i = strlen(file) - 1; i > 0; i--) {
if(file[i] == '/') {
if((file[i] == '/') || (file[i] == '\\')) {
i++;
break;
}
@ -157,18 +158,8 @@ void traceEvent (int eventTraceLevel, char* file, int line, char * format, ...)
snprintf(out_buf, sizeof(out_buf), "%s [%s:%d] %s%s", theDate, &file[i], line, extra_msg, buf);
fprintf(traceFile, "%s\n", out_buf);
fflush(traceFile);
#ifndef WIN32
}
#else
/* this is the WIN32 code */
for(i = strlen(file) - 1; i > 0; i--) {
if(file[i] == '\\') {
i++;
break;
}
}
snprintf(out_buf, sizeof(out_buf), "%s [%s:%d] %s%s", theDate, &file[i], line, extra_msg, buf);
fprintf(traceFile, "%s\n", out_buf);
fflush(traceFile);
#endif
}