Re: [PATCH virt-viewer 1/3] Use a custom log handler to silence debug messages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 10, 2014 at 05:40:01PM +0200, Marc-André Lureau wrote:
> 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 *

ACK

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list





[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux