Print messages with level below LOG_NOTICE to stderr.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>master
parent
158daa697d
commit
a41e9f8c8c
6
print.c
6
print.c
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue