~ubuntu-branches/ubuntu/maverick/telepathy-glib/maverick

« back to all changes in this revision

Viewing changes to telepathy-glib/debug-internal.h

  • Committer: Bazaar Package Importer
  • Author(s): Simon McVittie
  • Date: 2010-05-10 17:59:54 UTC
  • mfrom: (1.6.1 upstream) (27.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20100510175954-bxvqq3xx0sy4itmp
Tags: 0.11.5-1
New upstream version with new API/ABI

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
#include "config.h"
5
5
 
6
 
#ifdef ENABLE_DEBUG
7
 
 
8
6
#include <glib.h>
9
7
 
10
8
#include <telepathy-glib/debug.h>
15
13
 * and #key_to_domain, in debug.c */
16
14
typedef enum
17
15
{
 
16
  TP_DEBUG_MISC          = 1 << 0,
18
17
  TP_DEBUG_GROUPS        = 1 << 1,
19
18
  TP_DEBUG_PROPERTIES    = 1 << 2,
20
19
  TP_DEBUG_IM            = 1 << 3,
27
26
  TP_DEBUG_HANDLES       = 1 << 10,
28
27
  TP_DEBUG_CONTACTS      = 1 << 11,
29
28
  TP_DEBUG_ACCOUNTS      = 1 << 12,
30
 
  TP_DEBUG_DISPATCHER    = 1 << 13
 
29
  TP_DEBUG_DISPATCHER    = 1 << 13,
 
30
  TP_DEBUG_CLIENT        = 1 << 14
31
31
} TpDebugFlags;
32
32
 
33
33
gboolean _tp_debug_flag_is_set (TpDebugFlags flag);
34
34
void _tp_debug_set_flags (TpDebugFlags flags);
35
 
void _tp_debug (TpDebugFlags flag, const gchar *format, ...)
36
 
    G_GNUC_PRINTF (2, 3);
 
35
void _tp_log (GLogLevelFlags level, TpDebugFlags flag, const gchar *format, ...)
 
36
    G_GNUC_PRINTF (3, 4);
37
37
gboolean _tp_debug_is_persistent (void);
38
38
 
39
39
#define _TP_DEBUG_IS_PERSISTENT (_tp_debug_is_persistent ())
40
40
 
41
41
G_END_DECLS
42
42
 
43
 
#else
44
 
 
45
 
#define _TP_DEBUG_IS_PERSISTENT (0)
46
 
 
47
 
#endif /* ENABLE_DEBUG */
48
 
 
49
43
#endif /* __DEBUG_H__ */
50
44
 
51
45
/* ------------------------------------ */
67
61
 */
68
62
 
69
63
#ifdef DEBUG_FLAG
70
 
#ifdef ENABLE_DEBUG
 
64
 
 
65
#undef ERROR
 
66
#define ERROR(format, ...) \
 
67
  do \
 
68
    { \
 
69
      _tp_log (G_LOG_LEVEL_ERROR, DEBUG_FLAG, "%s: " format, \
 
70
          G_STRFUNC, ##__VA_ARGS__); \
 
71
      g_assert_not_reached (); \
 
72
    } \
 
73
  while (0)
 
74
 
 
75
#undef CRITICAL
 
76
#define CRITICAL(format, ...) \
 
77
  _tp_log (G_LOG_LEVEL_CRITICAL, DEBUG_FLAG, "%s: " format, \
 
78
      G_STRFUNC, ##__VA_ARGS__)
 
79
#undef WARNING
 
80
#define WARNING(format, ...) \
 
81
  _tp_log (G_LOG_LEVEL_WARNING, DEBUG_FLAG, "%s: " format, \
 
82
      G_STRFUNC, ##__VA_ARGS__)
 
83
#undef MESSAGE
 
84
#define MESSAGE(format, ...) \
 
85
  _tp_log (G_LOG_LEVEL_MESSAGE, DEBUG_FLAG, "%s: " format, \
 
86
      G_STRFUNC, ##__VA_ARGS__)
 
87
#undef INFO
 
88
#define INFO(format, ...) \
 
89
  _tp_log (G_LOG_LEVEL_INFO, DEBUG_FLAG, "%s: " format, \
 
90
      G_STRFUNC, ##__VA_ARGS__)
71
91
 
72
92
#undef DEBUG
73
 
#define DEBUG(format, ...) \
74
 
  _tp_debug (DEBUG_FLAG, "%s: " format, G_STRFUNC, ##__VA_ARGS__)
75
 
 
76
93
#undef DEBUGGING
77
 
#define DEBUGGING _tp_debug_flag_is_set (DEBUG_FLAG)
78
94
 
 
95
#ifdef ENABLE_DEBUG
 
96
#   define DEBUG(format, ...) \
 
97
      _tp_log (G_LOG_LEVEL_DEBUG, DEBUG_FLAG, "%s: " format, \
 
98
          G_STRFUNC, ##__VA_ARGS__)
 
99
#   define DEBUGGING _tp_debug_flag_is_set (DEBUG_FLAG)
79
100
#else /* !defined (ENABLE_DEBUG) */
80
 
 
81
 
#undef DEBUG
82
 
#define DEBUG(format, ...) do {} while (0)
83
 
 
84
 
#undef DEBUGGING
85
 
#define DEBUGGING 0
86
 
 
 
101
#   define DEBUG(format, ...) do {} while (0)
 
102
#   define DEBUGGING 0
87
103
#endif /* !defined (ENABLE_DEBUG) */
 
104
 
88
105
#endif /* defined (DEBUG_FLAG) */