Unable to find what would be the log domain name for gtkbuilder.c

81 Views Asked by At

I would like to redirect messages from g_warning() and similar functions from gtkbuilder.c such as the famous:

(main.exe:39280): Gtk-WARNING **: 01:34:48.787: Could not find signal ha ndler 'on_window_realize'. Did you compile with -rdynamic?

using g_log_set_handler(). It expects the domain name as the first parameter, which is what I can't seem to find. If G_LOG_DOMAIN is not defined in the source then it defaults to NULL in which case I won't be able to use g_log_set_handler() to redirect it.

What is the log domain name for it or alternatively - how can I redirect those messages after all (I am redirecting them to a GtkTextBuffer)?

1

There are 1 best solutions below

0
On

GTK is using structured logging, which means the g_log_set_handler() won’t work.

g_log_set_writer_func() should be used instead to catch every structured log and parse the given GLogWriterFunc in the callback.