aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorSeiji Aguchi <seiji.aguchi@hds.com>2013-07-03 23:02:46 -0400
committerLuiz Capitulino <lcapitulino@redhat.com>2013-07-10 13:42:09 -0400
commit5e2ac5191772dea782ff78e95edd395985273019 (patch)
tree804bd99545123456168886337c520707bd77ea2b /util
parentf53cae50f81449596e55159cfe61efbef9246b2e (diff)
add timestamp to error_report()
[Issue] When we offer a customer support service and a problem happens in a customer's system, we try to understand the problem by comparing what the customer reports with message logs of the customer's system. In this case, we often need to know when the problem happens. But, currently, there is no timestamp in qemu's error messages. Therefore, we may not be able to understand the problem based on error messages. [Solution] Add a timestamp to qemu's error message logged by error_report() with g_time_val_to_iso8601(). Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'util')
-rw-r--r--util/qemu-error.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/util/qemu-error.c b/util/qemu-error.c
index 08a36f480c..fec02c6075 100644
--- a/util/qemu-error.c
+++ b/util/qemu-error.c
@@ -196,6 +196,7 @@ void error_print_loc(void)
}
}
+bool enable_timestamp_msg;
/*
* Print an error message to current monitor if we have one, else to stderr.
* Format arguments like sprintf(). The result should not contain
@@ -206,6 +207,15 @@ void error_print_loc(void)
void error_report(const char *fmt, ...)
{
va_list ap;
+ GTimeVal tv;
+ gchar *timestr;
+
+ if (enable_timestamp_msg) {
+ g_get_current_time(&tv);
+ timestr = g_time_val_to_iso8601(&tv);
+ error_printf("%s ", timestr);
+ g_free(timestr);
+ }
error_print_loc();
va_start(ap, fmt);