mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
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>
This commit is contained in:
parent
f53cae50f8
commit
5e2ac51917
4 changed files with 49 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue