commit 19dd9a91879fda9008283972a1766133d83ed8bf Author: Eitan Isaacson Date: Tue Feb 16 17:34:46 2010 -0800 Use telepathy debug interface diff --git a/src/mcd-debug.c b/src/mcd-debug.c index 2242613..3f63a86 100644 --- a/src/mcd-debug.c +++ b/src/mcd-debug.c @@ -40,6 +40,7 @@ #include #include +#include #include @@ -186,3 +187,29 @@ mcd_debug_set_level (gint level) } } +void +mcd_debug(const gchar *format, + ...) +{ + TpDebugSender *dbg; + GTimeVal now; + gchar *message; + va_list args; + + va_start (args, format); + message = g_strdup_vprintf (format, args); + va_end (args); + + if (_mcd_debug_get_level () > 0) + g_debug ("%s", message); + + dbg = tp_debug_sender_dup (); + + g_get_current_time (&now); + + tp_debug_sender_add_message (dbg, &now, "", G_LOG_LEVEL_DEBUG, message); + + g_object_unref (dbg); + + g_free (message); +} diff --git a/src/mcd-debug.h b/src/mcd-debug.h index 99bfcdb..8e0742e 100644 --- a/src/mcd-debug.h +++ b/src/mcd-debug.h @@ -37,10 +37,8 @@ G_BEGIN_DECLS #ifdef ENABLE_DEBUG #define DEBUGGING (_mcd_debug_get_level () > 0) -#define DEBUG(format, ...) G_STMT_START { \ - if (_mcd_debug_get_level () > 0) \ - g_debug ("%s: " format, G_STRFUNC, ##__VA_ARGS__); \ -} G_STMT_END +#define DEBUG(format, ...) \ + mcd_debug ("%s: " format, G_STRFUNC, ##__VA_ARGS__) #else /* !defined ENABLE_DEBUG */ @@ -66,6 +64,8 @@ void mcd_debug_unref (gpointer obj, const gchar *filename, gint linenum) void mcd_debug_print_tree (gpointer obj); +void mcd_debug(const gchar *format, ...); + G_END_DECLS #endif /* __MCD_DEBUG_H__ */