summaryrefslogtreecommitdiff
path: root/gtk2_ardour/main.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-07-30 19:05:12 +0200
committerRobin Gareus <robin@gareus.org>2015-07-30 19:05:12 +0200
commitb2817bfac5499e77066817f83cccd0e206b6d20f (patch)
tree7263bfa3608a58c129d2947702c829ba14167977 /gtk2_ardour/main.cc
parentca0c9b3636fecb5fc2106b1eae33ce3eb5c53c79 (diff)
make it easier to get errors out of GTK + Glib
Diffstat (limited to 'gtk2_ardour/main.cc')
-rw-r--r--gtk2_ardour/main.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc
index f43d1bd4f4..441b2dc929 100644
--- a/gtk2_ardour/main.cc
+++ b/gtk2_ardour/main.cc
@@ -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;