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)?
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 givenGLogWriterFunc
in the callback.