GLib's Logging

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

 



Hi, folks.
I'm writing a library and want to print debug messages, by usingg_debug() macro. Is there a way to hide them by default, and let thecaller app show it by using g_set_handler()?
I have found a way, which is, in the library, call g_set_handler() usinga dummy function, which does nothing. So, it's up to the app using thelibrary 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 dothat stuff in the start of the program. But how to do this inside thelibrary?

**************************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 thatthe 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 Wendellwww.bani.com.br

_______________________________________________gtk-list mailing listgtk-list@xxxxxxxxxxxxx://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux