On Tue, 2014-06-24 at 09:50 +0200, Christophe Fergeau wrote: > Ping? > > On Thu, Jun 12, 2014 at 02:37:08PM +0200, Christophe Fergeau wrote: > > Commit 2bd835fb introduced a custom log handler to ensure > > we never show debug messages by default regardless of glib > > version (older glib were showing them by default). > > > > However this custom log handler does not take into account > > G_MESSAGES_DEBUG. This commit adds support for that and > > makes the handling of --debug identical between older and newer glibs. > > --- > > src/virt-viewer-app.c | 3 +-- > > src/virt-viewer-util.c | 14 ++++++++++++-- > > 2 files changed, 13 insertions(+), 4 deletions(-) > > > > diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c > > index 7dbb7fc..ad571c8 100644 > > --- a/src/virt-viewer-app.c > > +++ b/src/virt-viewer-app.c > > @@ -181,7 +181,6 @@ static guint signals[SIGNAL_LAST]; > > void > > virt_viewer_app_set_debug(gboolean debug) > > { > > -#if GLIB_CHECK_VERSION(2, 31, 0) > > if (debug) { > > const gchar *doms = g_getenv("G_MESSAGES_DEBUG"); > > if (!doms) { > > @@ -193,7 +192,7 @@ virt_viewer_app_set_debug(gboolean debug) > > g_free(newdoms); > > } > > } > > -#endif > > + > > doDebug = debug; > > } > > > > diff --git a/src/virt-viewer-util.c b/src/virt-viewer-util.c > > index 6fdaa07..6a20291 100644 > > --- a/src/virt-viewer-util.c > > +++ b/src/virt-viewer-util.c > > @@ -283,9 +283,19 @@ static void log_handler(const gchar *log_domain, > > const gchar *message, > > gpointer unused_data) > > { > > - if (glib_check_version(2, 32, 0) != NULL) > > - if (log_level >= G_LOG_LEVEL_DEBUG && !doDebug) > > +#if !GLIB_CHECK_VERSION(2, 31, 0) > > + /* Older glibs were showing G_LOG_LEVEL_DEBUG messages by default */ > > + if ((log_level == G_LOG_LEVEL_INFO) > > + || (log_level == G_LOG_LEVEL_DEBUG)) { > > + const char *domains = g_getenv ("G_MESSAGES_DEBUG"); > > + > > + if (domains == NULL) > > + return; > > + if ((strcmp(domains, "all") != 0) && > > + (strstr(domains, G_LOG_DOMAIN) == NULL)) > > return; Can we use a static boolean flag here so that we don't have to strcmp every single time this function is called to determine whether we should log the message or not? > > + } > > +#endif > > > > g_log_default_handler(log_domain, log_level, message, unused_data); > > } > > -- > > 1.9.3 > > > > _______________________________________________ > > virt-tools-list mailing list > > virt-tools-list@xxxxxxxxxx > > https://www.redhat.com/mailman/listinfo/virt-tools-list > _______________________________________________ > virt-tools-list mailing list > virt-tools-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/virt-tools-list _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list