summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sf.net>2010-10-11 23:14:43 +0300
committerStefan Kost <ensonic@users.sf.net>2010-10-11 23:14:43 +0300
commitf764f9e4f537edcf1f5b867fb18e9b79ef7d099d (patch)
tree93bee5c7be3428c9fcaddde5c721cfb2dce82cb4
parentcd9e6909ec4bedd8865dba80a440e4b8d6f14909 (diff)
ui: use envvar to activate debug prints if enabled at configure
-rw-r--r--README6
-rw-r--r--src/ui/gsttlui.c16
-rw-r--r--src/ui/gsttlui.h2
3 files changed, 22 insertions, 2 deletions
diff --git a/README b/README
index 9622923..d658ac5 100644
--- a/README
+++ b/README
@@ -79,6 +79,12 @@ make some noise:
Instead of the UI one can also use netcat again:
netcat -l -p 8765 127.0.0.1
netcat -l 127.0.0.1 8765
+
+If the package is configured with --enable-trace one can get debug prints from the UI:
+ GSTTLUI_DEBUG=1 gsttlui
+
+If the UI crashes it is most likely grphviz :/
+graphviz version 2.26.3 (20100126.1600)
=== In the future ===
pygtk ui using mathplotlib
diff --git a/src/ui/gsttlui.c b/src/ui/gsttlui.c
index 0f5cee5..d4020e7 100644
--- a/src/ui/gsttlui.c
+++ b/src/ui/gsttlui.c
@@ -57,7 +57,10 @@ on_window_destroy (GtkWidget *widget, gpointer user_data)
}
#ifdef ENABLE_TRACE
-void _log_printf(const gchar *file, guint line, const gchar *func, const gchar *fmt,...) {
+
+void (*_log_printf)(const gchar *file, guint line, const gchar *func, const gchar *fmt,...);
+
+static void _log_printf_stdout(const gchar *file, guint line, const gchar *func, const gchar *fmt,...) {
va_list args;
va_start(args, fmt);
@@ -67,6 +70,9 @@ void _log_printf(const gchar *file, guint line, const gchar *func, const gchar *
fflush(stdout);
va_end(args);
}
+
+static void _log_printf_null(const gchar *file, guint line, const gchar *func, const gchar *fmt,...) {
+}
#endif
gint
@@ -99,6 +105,14 @@ main (gint argc, gchar *argv[])
g_option_context_free (ctx);
exit (1);
}
+
+#ifdef ENABLE_TRACE
+ if (getenv("GSTTLUI_DEBUG")) {
+ _log_printf = _log_printf_stdout;
+ } else {
+ _log_printf = _log_printf_null;
+ }
+#endif
/* take log filename from remaining args if there are any and we have no
* filename yet */
diff --git a/src/ui/gsttlui.h b/src/ui/gsttlui.h
index 920e938..1a6e56e 100644
--- a/src/ui/gsttlui.h
+++ b/src/ui/gsttlui.h
@@ -107,7 +107,7 @@ extern GQuark log_event_type_topo_link_rem;
/* debug logging */
#ifdef ENABLE_TRACE
-extern void _log_printf(const gchar *file, const guint line, const gchar *func, const gchar *fmt, ...);
+extern void (*_log_printf)(const gchar *file, const guint line, const gchar *func, const gchar *fmt, ...);
# define TRACE(...) _log_printf(__FILE__,__LINE__,__FUNCTION__,__VA_ARGS__)
#else
# define TRACE(...)