13
0

make it easier to get errors out of GTK + Glib

This commit is contained in:
Robin Gareus 2015-07-30 19:05:12 +02:00
parent ca0c9b3636
commit b2817bfac5

View File

@ -99,6 +99,28 @@ gui_jack_error ()
win.run ();
}
#ifndef NDEBUG
static void ardour_g_log (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) {
switch (log_level) {
case G_LOG_FLAG_FATAL:
case G_LOG_LEVEL_CRITICAL:
fatal << "g_log: " << message << endmsg;
break;
case G_LOG_LEVEL_ERROR:
error << "g_log: " << message << endmsg;
break;
case G_LOG_LEVEL_WARNING:
warning << "g_log: " << message << endmsg;
break;
case G_LOG_LEVEL_MESSAGE:
case G_LOG_LEVEL_INFO:
default:
info << "g_log: " << message << endmsg;
break;
}
}
#endif
static gboolean
tell_about_backend_death (void* /* ignored */)
{
@ -359,6 +381,12 @@ int main (int argc, char *argv[])
exit (1);
}
#ifndef NDEBUG
g_log_set_handler (NULL,
GLogLevelFlags (G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL | G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_RECURSION),
&ardour_g_log, NULL);
#endif
ui->run (text_receiver);
Gtkmm2ext::Application::instance()->cleanup();
delete ui;