X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/27d3cdbc943a57d64f4f2a35a4f1e1b15d9ca41f..74e708d85a5589ab973e2db6cf2ce20204fc82a4:/log.c diff --git a/log.c b/log.c index a3f77874..21b5c1c2 100644 --- a/log.c +++ b/log.c @@ -51,7 +51,8 @@ static char *timestring(void ) static void logit(int priority, char *buf) { if (logfile) { - fprintf(logfile,"%s %s", timestring(), buf); + fprintf(logfile,"%s [%d] %s", + timestring(), (int)getpid(), buf); fflush(logfile); } else { syslog(priority, "%s", buf); @@ -209,6 +210,20 @@ void log_recv(struct file_struct *file) } } +/* called when the transfer is interrupted for some reason */ +void log_exit(int code) +{ + if (code == 0) { + extern struct stats stats; + rprintf(FLOG,"wrote %.0f bytes read %.0f bytes total size %.0f\n", + (double)stats.total_written, + (double)stats.total_read, + (double)stats.total_size); + } else { + rprintf(FLOG,"transfer interrupted\n"); + } +} + /* log the incoming transfer of a file for interactive use, this will be called at the end where the client was run */ void log_transfer(struct file_struct *file, char *fname) @@ -219,3 +234,4 @@ void log_transfer(struct file_struct *file, char *fname) rprintf(FINFO,"%s\n", fname); } +