Skip to content

Commit

Permalink
[NEW] defaults to logging to stdout if no logfile is set
Browse files Browse the repository at this point in the history
  • Loading branch information
128keaton committed Sep 21, 2023
1 parent 2b7747b commit de18e4b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions util.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,14 @@ void xlog(struct udata *ud, char *fmt, ...)
FILE *fp;
off_t pos;

fp = (ud == NULL) ? stderr : ud->logfp;
fp = (ud == NULL) ? stderr : ud->logfp;

if (fp == NULL) {
fp = stdout;
} else {
fprintf(fp, "%s %lld pid=%d ", tstamp(now), (long long)now, getpid());
}

fprintf(fp, "%s %lld pid=%d ", tstamp(now), (long long)now, getpid());
va_start(ap, fmt);

vfprintf(fp, fmt, ap);
Expand Down

0 comments on commit de18e4b

Please sign in to comment.