[Telepathy-commits] [telepathy-gabble/master] use tp_debug_divert_messages instead of our own copy of it

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Thu Aug 7 02:14:10 PDT 2008


20080807091410-7fe3f-2277c77b008b24567d8886fb93eb521b58a6d833.gz
---
 src/debug.c  |   33 ---------------------------------
 src/debug.h  |    6 ------
 src/gabble.c |    2 +-
 3 files changed, 1 insertions(+), 40 deletions(-)

diff --git a/src/debug.c b/src/debug.c
index 5983d5c..6468bc1 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -12,39 +12,6 @@
 #include <glib/gstdio.h>
 #include <telepathy-glib/debug.h>
 
-void
-gabble_debug_set_log_file_from_env (void)
-{
-  const gchar *output_file;
-  int out;
-
-  output_file = g_getenv ("GABBLE_LOGFILE");
-  if (output_file == NULL)
-    return;
-
-  out = g_open (output_file, O_WRONLY | O_CREAT | O_TRUNC, 0644);
-  if (out == -1)
-    {
-      g_warning ("Can't open logfile '%s': %s", output_file,
-          g_strerror (errno));
-      return;
-    }
-
-  if (dup2 (out, STDOUT_FILENO) == -1)
-    {
-      g_warning ("Error when duplicating stdout file descriptor: %s",
-          g_strerror (errno));
-      return;
-    }
-
-  if (dup2 (out, STDERR_FILENO) == -1)
-    {
-      g_warning ("Error when duplicating stderr file descriptor: %s",
-          g_strerror (errno));
-      return;
-    }
-}
-
 #ifdef ENABLE_DEBUG
 
 static GabbleDebugFlags flags = 0;
diff --git a/src/debug.h b/src/debug.h
index 72a5afe..c6e4f32 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -6,12 +6,6 @@
 
 #include <glib.h>
 
-G_BEGIN_DECLS
-
-void gabble_debug_set_log_file_from_env (void);
-
-G_END_DECLS
-
 #ifdef ENABLE_DEBUG
 
 G_BEGIN_DECLS
diff --git a/src/gabble.c b/src/gabble.c
index 8f0a6a1..8e50a47 100644
--- a/src/gabble.c
+++ b/src/gabble.c
@@ -61,7 +61,7 @@ int
 gabble_main (int argc,
              char **argv)
 {
-  gabble_debug_set_log_file_from_env ();
+  tp_debug_divert_messages (g_getenv ("GABBLE_LOGFILE"));
 
 #ifdef ENABLE_DEBUG
   gabble_debug_set_flags_from_env ();
-- 
1.5.6.3




More information about the Telepathy-commits mailing list