Browse Source

simplified the path in the log (#910)

pull/914/head
fengdaolong 3 years ago
committed by GitHub
parent
commit
2378ea0be2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      src/n2n.c

15
src/n2n.c

@ -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
}

Loading…
Cancel
Save