[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] log: Make glib logging go through QEMU
From: |
Daniel P . Berrangé |
Subject: |
Re: [Qemu-devel] [PATCH v2] log: Make glib logging go through QEMU |
Date: |
Thu, 13 Dec 2018 11:52:12 +0000 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Thu, Dec 13, 2018 at 12:26:12PM +0100, Christophe Fergeau wrote:
> This commit adds a qemu_init_logging() helper which calls
> g_log_set_default_handler() so that glib logs (g_log, g_warning, ...)
> are handled similarly to other QEMU logs. This means they will get a
> timestamp if timestamps are enabled, and they will go through the
> monitor if one is configured.
> This commit also adds a call to qemu_init_logging() to the binaries
> installed by QEMU.
>
> At the moment, this change will mostly impact SPICE logging if your
> spice version is >= 0.14.1. With older spice versions, this is not going
> to work as expected, but will not have any ill effect, so this call is
> not conditional on the SPICE version.
>
> Signed-off-by: Christophe Fergeau <address@hidden>
> ---
> Changes since v1:
> - introduced a qemu_init_logging() helper, and call that in more
> binaries than just vl.c
> +static void qemu_log_func(const gchar *log_domain,
> + GLogLevelFlags log_level,
> + const gchar *message,
> + gpointer user_data)
> +{
> + switch (log_level & G_LOG_LEVEL_MASK) {
> + case G_LOG_LEVEL_DEBUG:
> + break;
> + case G_LOG_LEVEL_INFO:
> + /* Fall through */
> + case G_LOG_LEVEL_MESSAGE:
> + info_report("%s", message);
> + break;
> + case G_LOG_LEVEL_WARNING:
> + /* Fall through */
> + case G_LOG_LEVEL_CRITICAL:
> + warn_report("%s", message);
> + break;
This didn't adress my previous comment that _CRITICAL should do an
error_report, not warn_reoprt.
> + case G_LOG_LEVEL_ERROR:
> + error_report("%s", message);
> + break;
> + }
> +}
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|