diff --git a/src/ckpool.c b/src/ckpool.c index c2ca2348..ca07b3c2 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -81,6 +81,13 @@ void logmsg(int loglevel, const char *fmt, ...) { tm.tm_hour, tm.tm_min, 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) { char *msg; @@ -90,13 +97,6 @@ void logmsg(int loglevel, const char *fmt, ...) { ASPRINTF(&msg, "%s %s\n", stamp, buf); 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); } }