|
|
@ -81,6 +81,13 @@ void logmsg(int loglevel, const char *fmt, ...) { |
|
|
|
tm.tm_hour, |
|
|
|
tm.tm_hour, |
|
|
|
tm.tm_min, |
|
|
|
tm.tm_min, |
|
|
|
tm.tm_sec); |
|
|
|
tm.tm_sec); |
|
|
|
|
|
|
|
if (loglevel <= LOG_WARNING) {\
|
|
|
|
|
|
|
|
if (loglevel <= LOG_ERR && errno != 0) |
|
|
|
|
|
|
|
fprintf(stderr, "%s %s with errno %d: %s\n", stamp, buf, errno, strerror(errno)); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
fprintf(stderr, "%s %s\n", stamp, buf); |
|
|
|
|
|
|
|
fflush(stderr); |
|
|
|
|
|
|
|
} |
|
|
|
if (logfd) { |
|
|
|
if (logfd) { |
|
|
|
char *msg; |
|
|
|
char *msg; |
|
|
|
|
|
|
|
|
|
|
@ -90,13 +97,6 @@ void logmsg(int loglevel, const char *fmt, ...) { |
|
|
|
ASPRINTF(&msg, "%s %s\n", stamp, buf); |
|
|
|
ASPRINTF(&msg, "%s %s\n", stamp, buf); |
|
|
|
ckmsgq_add(global_ckp->logger, msg); |
|
|
|
ckmsgq_add(global_ckp->logger, msg); |
|
|
|
} |
|
|
|
} |
|
|
|
if (loglevel <= LOG_WARNING) {\
|
|
|
|
|
|
|
|
if (loglevel <= LOG_ERR && errno != 0) |
|
|
|
|
|
|
|
fprintf(stderr, "%s %s with errno %d: %s\n", stamp, buf, errno, strerror(errno)); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
fprintf(stderr, "%s %s\n", stamp, buf); |
|
|
|
|
|
|
|
fflush(stderr); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
free(buf); |
|
|
|
free(buf); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|