[virt-tools-list] [PATCH virt-viewer 1/3] Use a custom log handler to silence debug messages
Marc-André Lureau
marcandre.lureau at gmail.com
Tue Jun 10 15:40:01 UTC 2014
On RHEL6, with old glib, all g_log messages are printed.
Filter the messages with a custom handler instead.
---
src/virt-viewer-util.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/virt-viewer-util.c b/src/virt-viewer-util.c
index 4c60583..c81c09a 100644
--- a/src/virt-viewer-util.c
+++ b/src/virt-viewer-util.c
@@ -278,6 +278,18 @@ gulong virt_viewer_signal_connect_object(gpointer instance,
return ctx->handler_id;
}
+static void log_handler(const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer unused_data)
+{
+ if (!glib_check_version(2, 32, 0))
+ if (log_level >= G_LOG_LEVEL_DEBUG && !doDebug)
+ return;
+
+ g_log_default_handler(log_domain, log_level, message, unused_data);
+}
+
void virt_viewer_util_init(const char *appname)
{
#ifdef G_OS_WIN32
@@ -310,6 +322,8 @@ void virt_viewer_util_init(const char *appname)
textdomain(GETTEXT_PACKAGE);
g_set_application_name(appname);
+
+ g_log_set_default_handler(log_handler, NULL);
}
static gchar *
--
1.9.3
More information about the virt-tools-list
mailing list