]> git.proxmox.com Git - mirror_qemu.git/blobdiff - util/qemu-error.c
add timestamp to error_report()
[mirror_qemu.git] / util / qemu-error.c
index 08a36f480c841cc2223b6185da02fd96385fed11..fec02c60754b1051d6b5868ceb6d0290f7019c48 100644 (file)
@@ -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);