[Telepathy-commits] [telepathy-haze/master] Move tp-glib debug initialization to debug.c

Will Thompson will.thompson at collabora.co.uk
Wed Aug 13 09:06:53 PDT 2008


---
 src/debug.c |   16 ++++++++++++++++
 src/debug.h |    2 ++
 src/main.c  |   10 +---------
 3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/debug.c b/src/debug.c
index 9b1dc8b..861a503 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -18,10 +18,13 @@
  *
  */
 
+#include "debug.h"
+
 #include <string.h>
 #include <stdarg.h>
 
 #include <libpurple/debug.h>
+#include <telepathy-glib/debug.h>
 
 static char *debug_level_names[] =
 {
@@ -124,3 +127,16 @@ haze_debug (const gchar *format,
 
     va_end (args);
 }
+
+void
+haze_debug_set_flags_from_env ()
+{
+    tp_debug_set_flags (g_getenv ("HAZE_DEBUG"));
+
+    if (g_getenv ("HAZE_PERSIST"))
+        tp_debug_set_persistent (TRUE);
+
+#ifdef HAVE_TP_DEBUG_DIVERT_MESSAGES
+    tp_debug_divert_messages (g_getenv ("HAZE_LOGFILE"));
+#endif
+}
diff --git a/src/debug.h b/src/debug.h
index f51d6b2..020df3f 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -25,5 +25,7 @@ void haze_debug_init(void);
 void haze_debug (const gchar *format, ...)
     G_GNUC_PRINTF (1,2);
 
+void haze_debug_set_flags_from_env ();
+
 #define DEBUG(format, ...) \
     haze_debug ("%s: " format, G_STRFUNC, ##__VA_ARGS__)
diff --git a/src/main.c b/src/main.c
index 7c57503..d613793 100644
--- a/src/main.c
+++ b/src/main.c
@@ -50,7 +50,6 @@ extern const guint purple_micro_version;
 #endif
 
 #include <telepathy-glib/run.h>
-#include <telepathy-glib/debug.h>
 
 #include "defines.h"
 #include "debug.h"
@@ -269,14 +268,7 @@ main(int argc,
 
     g_set_prgname(UI_ID);
 
-    tp_debug_set_flags (g_getenv ("HAZE_DEBUG"));
-
-    if (g_getenv ("HAZE_PERSIST"))
-        tp_debug_set_persistent (TRUE);
-
-#ifdef HAVE_TP_DEBUG_DIVERT_MESSAGES
-    tp_debug_divert_messages (g_getenv ("HAZE_LOGFILE"));
-#endif
+    haze_debug_set_flags_from_env ();
 
     signal (SIGCHLD, SIG_IGN);
     init_libpurple();
-- 
1.5.6.3




More information about the Telepathy-commits mailing list