summaryrefslogtreecommitdiffstats
path: root/lib/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/log.c')
-rw-r--r--lib/log.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/log.c b/lib/log.c
index 4924782..6f0f40a 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -1,5 +1,6 @@
#include <string.h>
#include <time.h>
+#include <errno.h>
#include "log.h"
/* TODO: replace this with something thread-safe later. */
@@ -41,6 +42,7 @@ void vl_logv(unsigned level, const char *fmt, va_list args)
char datebuf[MAX_LOGTIMELEN];
time_t now;
struct tm now_tm;
+ int en = errno;
if (log_level > level) return;
if (level > LOG_ERROR) return;
@@ -55,7 +57,9 @@ void vl_logv(unsigned level, const char *fmt, va_list args)
strcpy(datebuf, "???");
}
- fprintf(log_stream(level), "[%s] %s: %s\n", datebuf, log_names[level], buf);
+ fprintf(log_stream(level), "[%s] %5s: %s\n", datebuf, log_names[level], buf);
+
+ errno = en;
}
void vl_log(unsigned level, const char *fmt, ...)