diff --git a/src/log.c b/src/log.c index 7d4ca60..8eff4bd 100644 --- a/src/log.c +++ b/src/log.c @@ -17,6 +17,7 @@ * USA */ +#include #include #include #include @@ -55,6 +56,15 @@ static const char *log_ident() static inline void log_write_stdout(int priority, const char *fmt, va_list ap) { + time_t now; + struct tm tm; + char buf[32]; + + now = time(NULL); + localtime_r(&now, &tm); + strftime(buf, sizeof(buf), "%Y/%m/%d %H:%M:%S", &tm); + + fprintf(stderr, "%s ", buf); vfprintf(stderr, fmt, ap); }