From ad5afbe6bbb43332240f28cc00c02ce16bcaa226 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 29 Apr 2014 10:23:16 +1000 Subject: [PATCH] Add datestamp to logging --- src/ckpool.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ckpool.h b/src/ckpool.h index 79bf2e72..6dd396e4 100644 --- a/src/ckpool.h +++ b/src/ckpool.h @@ -69,6 +69,17 @@ ckpool_t *global_ckp; #define LOGMSG(_loglevel, fmt, ...) do { \ if (global_ckp->loglevel >= _loglevel && fmt) { \ + struct tm *tm; \ + time_t now_t; \ + now_t = time(NULL); \ + tm = localtime(&now_t); \ + fprintf(stderr, "[%d-%02d-%02d %02d:%02d:%02d] ", \ + tm->tm_year + 1900, \ + tm->tm_mon + 1, \ + tm->tm_mday, \ + tm->tm_hour, \ + tm->tm_min, \ + tm->tm_sec); \ fprintf(stderr, fmt, ##__VA_ARGS__); \ fprintf(stderr, "\n"); \ if (_loglevel <= LOG_ERR) \