Print messages with level below LOG_NOTICE to stderr.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
master
Miroslav Lichvar 2013-02-05 17:36:09 +01:00 committed by Richard Cochran
parent 158daa697d
commit a41e9f8c8c
1 changed files with 4 additions and 2 deletions

View File

@ -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;
@ -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",