libvirt/libvirt-0.9.6-logging-Add-d...

31 lines
1.1 KiB
Diff

From 69b05e20e64836c3a1a125b17b0101f70492ffd7 Mon Sep 17 00:00:00 2001
From: Jiri Denemark <jdenemar@redhat.com>
Date: Wed, 28 Sep 2011 16:44:50 +0200
Subject: [PATCH 02/13] logging: Add date to log timestamp
(prerequisite patch, direct cherry-pick of upstream 11c6e09, to
resolve: https://bugzilla.redhat.com/show_bug.cgi?id=757382)
---
src/util/logging.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/util/logging.c b/src/util/logging.c
index 4ffaf75..9df9003 100644
--- a/src/util/logging.c
+++ b/src/util/logging.c
@@ -627,8 +627,10 @@ virLogFormatTimestamp(void)
gettimeofday(&cur_time, NULL);
localtime_r(&cur_time.tv_sec, &time_info);
+ time_info.tm_year += 1900;
- if (virAsprintf(&str, "%02d:%02d:%02d.%03d",
+ if (virAsprintf(&str, "%4d-%02d-%02d %02d:%02d:%02d.%03d",
+ time_info.tm_year, time_info.tm_mon, time_info.tm_mday,
time_info.tm_hour, time_info.tm_min, time_info.tm_sec,
(int) (cur_time.tv_usec / 1000)) < 0)
return NULL;
--
1.7.7.3