From 1904ecc165735a859ef6a25fc7a8bd0c14505153 Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 11 May 2009 19:45:47 +0200 Subject: [PATCH] timestamp in log lines --- redis.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/redis.c b/redis.c index 7f1cc3b61..39e85124b 100644 --- a/redis.c +++ b/redis.c @@ -556,7 +556,12 @@ void redisLog(int level, const char *fmt, ...) va_start(ap, fmt); if (level >= server.verbosity) { char *c = ".-*"; - fprintf(fp,"%c ",c[level]); + char buf[64]; + time_t now; + + now = time(NULL); + strftime(buf,64,"%d %b %H:%M:%S",gmtime(&now)); + fprintf(fp,"%s %c ",buf,c[level]); vfprintf(fp, fmt, ap); fprintf(fp,"\n"); fflush(fp);