Dongli Zhang <dongli.zh...@oracle.com> writes: > The qemu_log is very helpful for diagnostic. Add the timestamp to the log > when it is enabled (e.g., "-msg timestamp=on"). > > While there are many other places that may print to log file, this patch is > only for qemu_log(), e.g., the developer may add qemu_log/qemu_log_mask to > selected locations to diagnose QEMU issue.
Opinions on the new feature, anyone? > Cc: Joe Jin <joe....@oracle.com> > Signed-off-by: Dongli Zhang <dongli.zh...@oracle.com> > --- > Please let me know if we should use 'error_with_guestname' as well. > > util/log.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/util/log.c b/util/log.c > index d6eb037..f0a081a 100644 > --- a/util/log.c > +++ b/util/log.c > @@ -129,8 +129,15 @@ void qemu_log(const char *fmt, ...) > { > FILE *f = qemu_log_trylock(); > if (f) { > + gchar *timestr; > va_list ap; > > + if (message_with_timestamp) { > + timestr = real_time_iso8601(); > + fprintf(f, "%s ", timestr); > + g_free(timestr); > + } > + > va_start(ap, fmt); > vfprintf(f, fmt, ap); > va_end(ap); This extends -msg timestamp=on to apply to log messages without documenting it in -help or anywhere else. Needs fixing.