Skip to content

Commit

Permalink
Print messages with level below LOG_NOTICE to stderr.
Browse files Browse the repository at this point in the history
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
  • Loading branch information
mlichvar authored and richardcochran committed Feb 6, 2013
1 parent 158daa6 commit a41e9f8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions print.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ void print(int level, char const *format, ...)
struct timespec ts;
va_list ap;
char buf[1024];
FILE *f;

if (level > print_level)
return;
Expand All @@ -65,10 +66,11 @@ void print(int level, char const *format, ...)
va_end(ap);

if (verbose) {
fprintf(stdout, "%s[%ld.%03ld]: %s\n",
f = level >= LOG_NOTICE ? stdout : stderr;
fprintf(f, "%s[%ld.%03ld]: %s\n",
progname ? progname : "",
ts.tv_sec, ts.tv_nsec / 1000000, buf);
fflush(stdout);
fflush(f);
}
if (use_syslog) {
syslog(level, "[%ld.%03ld] %s",
Expand Down

0 comments on commit a41e9f8

Please sign in to comment.