Skip to content

Commit

Permalink
mxq_log: Log to stderr and not to stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
mariux committed Jun 15, 2015
1 parent 6aa0c2f commit f3d826b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mxq_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ int mx_log_print(char *msg, size_t len)
timetag(timebuf, sizeof(timebuf));

if (cnt > 1)
printf("%s %s[%d]: last message repeated %d times\n", timebuf, program_invocation_short_name, getpid(), cnt);
fprintf(stderr, "%s %s[%d]: last message repeated %d times\n", timebuf, program_invocation_short_name, getpid(), cnt);
else if (cnt == 1)
printf("%s %s[%d]: %s\n", timebuf, program_invocation_short_name, getpid(), lastmsg);
fprintf(stderr, "%s %s[%d]: %s\n", timebuf, program_invocation_short_name, getpid(), lastmsg);

if (lastmsg)
mx_free_null(lastmsg);
Expand All @@ -83,8 +83,8 @@ int mx_log_print(char *msg, size_t len)
lastlen = len;
cnt = 0;

printf("%s %s[%d]: %s\n", timebuf, program_invocation_short_name, getpid(), msg);
fflush(stdout);
fprintf(stderr, "%s %s[%d]: %s\n", timebuf, program_invocation_short_name, getpid(), msg);
fflush(stderr);

return 1;
}

0 comments on commit f3d826b

Please sign in to comment.