[gtk-vnc-devel] GLib's Logging
- From: Jonh Wendell <jwendell gnome org>
- To: gtk-vnc-devel List <gtk-vnc-devel lists sourceforge net>
- Subject: [gtk-vnc-devel] GLib's Logging
- Date: Wed, 26 Mar 2008 18:47:03 -0300
Hi, folks.
I'm writing a library and want to print debug messages, by using
g_debug() macro. Is there a way to hide them by default, and let the
caller app show it by using g_set_handler()?
I have found a way, which is, in the library, call g_set_handler() using
a dummy function, which does nothing. So, it's up to the app using the
library to show or not the messages, by calling g_set_handler().
The problem is that in order to the above approach work, I have to do
that stuff in the start of the program. But how to do this inside the
library?
**************************
My library:
static void dummy_log ( const gchar *log_domain G_GNUC_UNUSED,
GLogLevelFlags log_level G_GNUC_UNUSED,
const gchar *message G_GNUC_UNUSED,
gpointer user_data G_GNUC_UNUSED)
{
}
void disable_debug (void)
{
g_log_set_handler (G_LOG_DOMAIN,
G_LOG_LEVEL_DEBUG,
dummy_log,
NULL);
}
*********
So, at some point in my library, I have to call disable_debug(), so that
the messages in g_debug() don't appear in stdout. How to do this?
Or is there another way to hide the messages by default?
Thanks,
--
Jonh Wendell
www.bani.com.br
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]