diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2007-11-15 19:00:43 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2007-11-15 19:00:43 +0000 |
commit | 6705ba5447000f277007e60f2ca5b64a29beddd0 (patch) | |
tree | 533160a693fcb46b1d9018dad615bfee17c2121c /telepathy-glib/debug-internal.h | |
parent | d3fd33332291f3b3068ada2ce39a9ec02a73eb47 (diff) | |
download | telepathy-glib-6705ba5447000f277007e60f2ca5b64a29beddd0.tar.gz |
Change all internal-*.h to a more conventional *-internal.h
20071115190043-53eee-ed834b56ee1a271c42809e00f033e2aa55b9baf6.gz
Diffstat (limited to 'telepathy-glib/debug-internal.h')
-rw-r--r-- | telepathy-glib/debug-internal.h | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/telepathy-glib/debug-internal.h b/telepathy-glib/debug-internal.h new file mode 100644 index 000000000..c30207268 --- /dev/null +++ b/telepathy-glib/debug-internal.h @@ -0,0 +1,84 @@ +#ifndef __DEBUG_H__ +#define __DEBUG_H__ + +#include "config.h" + +#ifdef ENABLE_DEBUG + +#include <glib.h> + +#include <telepathy-glib/debug.h> + +G_BEGIN_DECLS + +/* Please keep this enum in sync with #keys, and the section gtkdoc, + * in debug.c */ +typedef enum +{ + TP_DEBUG_GROUPS = 1 << 1, + TP_DEBUG_PROPERTIES = 1 << 2, + TP_DEBUG_IM = 1 << 3, + TP_DEBUG_CONNECTION = 1 << 4, + TP_DEBUG_PARAMS = 1 << 5, + TP_DEBUG_PRESENCE = 1 << 6, + TP_DEBUG_MANAGER = 1 << 7, + TP_DEBUG_CHANNEL = 1 << 8, + TP_DEBUG_PROXY = 1 << 9 +} TpDebugFlags; + +gboolean _tp_debug_flag_is_set (TpDebugFlags flag); +void _tp_debug_set_flags (TpDebugFlags flags); +void _tp_debug (TpDebugFlags flag, const gchar *format, ...) + G_GNUC_PRINTF (2, 3); +gboolean _tp_debug_is_persistent (void); + +#define _TP_DEBUG_IS_PERSISTENT (_tp_debug_is_persistent ()) + +G_END_DECLS + +#else + +#define _TP_DEBUG_IS_PERSISTENT (0) + +#endif /* ENABLE_DEBUG */ + +#endif /* __DEBUG_H__ */ + +/* ------------------------------------ */ + +/* Below this point is outside the __DEBUG_H__ guard - so it can take effect + * more than once. So you can do: + * + * #define DEBUG_FLAG TP_DEBUG_ONE_THING + * #include "internal-debug.h" + * ... + * DEBUG ("if we're debugging one thing"); + * ... + * #undef DEBUG_FLAG + * #define DEBUG_FLAG TP_DEBUG_OTHER_THING + * #include "internal-debug.h" + * ... + * DEBUG ("if we're debugging the other thing"); + * ... + */ + +#ifdef DEBUG_FLAG +#ifdef ENABLE_DEBUG + +#undef DEBUG +#define DEBUG(format, ...) \ + _tp_debug (DEBUG_FLAG, "%s: " format, G_STRFUNC, ##__VA_ARGS__) + +#undef DEBUGGING +#define DEBUGGING _tp_debug_flag_is_set (DEBUG_FLAG) + +#else /* !defined (ENABLE_DEBUG) */ + +#undef DEBUG +#define DEBUG(format, ...) do {} while (0) + +#undef DEBUGGING +#define DEBUGGING 0 + +#endif /* !defined (ENABLE_DEBUG) */ +#endif /* defined (DEBUG_FLAG) */ |