1 /* |
|
2 * debug.h - Header for GabbleConnection |
|
3 * Copyright (C) 2005 Collabora Ltd. |
|
4 * |
|
5 * This library is free software; you can redistribute it and/or |
|
6 * modify it under the terms of the GNU Lesser General Public |
|
7 * License as published by the Free Software Foundation; either |
|
8 * version 2.1 of the License, or (at your option) any later version. |
|
9 * |
|
10 * This library is distributed in the hope that it will be useful, |
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 * Lesser General Public License for more details. |
|
14 * |
|
15 * You should have received a copy of the GNU Lesser General Public |
|
16 * License along with this library; if not, write to the Free Software |
|
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
18 */ |
|
19 #ifndef __DEBUG_H__ |
|
20 #define __DEBUG_H_ |
|
21 |
|
22 #include "config.h" |
|
23 |
|
24 #include <glib.h> |
|
25 |
|
26 #include "gabble_enums.h" |
|
27 |
|
28 |
|
29 /*#ifdef ENABLE_DEBUG bsr */ |
|
30 |
|
31 G_BEGIN_DECLS |
|
32 |
|
33 /*Moved to gabble_enums.h |
|
34 typedef enum |
|
35 { |
|
36 GABBLE_DEBUG_PRESENCE = 1 << 0, |
|
37 GABBLE_DEBUG_GROUPS = 1 << 1, |
|
38 GABBLE_DEBUG_ROSTER = 1 << 2, |
|
39 GABBLE_DEBUG_DISCO = 1 << 3, |
|
40 GABBLE_DEBUG_PROPERTIES = 1 << 4, |
|
41 GABBLE_DEBUG_ROOMLIST = 1 << 5, |
|
42 GABBLE_DEBUG_MEDIA = 1 << 6, |
|
43 GABBLE_DEBUG_MUC = 1 << 7, |
|
44 GABBLE_DEBUG_CONNECTION = 1 << 8, |
|
45 GABBLE_DEBUG_IM = 1 << 9, |
|
46 GABBLE_DEBUG_PERSIST = 1 << 10, |
|
47 GABBLE_DEBUG_VCARD = 1 << 11, |
|
48 } GabbleDebugFlags; |
|
49 */ |
|
50 |
|
51 #ifdef SYMBIAN |
|
52 IMPORT_C |
|
53 #endif |
|
54 void gabble_debug_set_flags_from_env (); |
|
55 #ifdef SYMBIAN |
|
56 IMPORT_C |
|
57 #endif |
|
58 void gabble_debug_set_flags (GabbleDebugFlags flags); |
|
59 |
|
60 gboolean gabble_debug_flag_is_set (GabbleDebugFlags flag); |
|
61 void gabble_debug (GabbleDebugFlags flag, const gchar *format, ...); |
|
62 /* bsr G_GNUC_PRINTF (2, 3); */ |
|
63 #ifdef ENABLE_DEBUG /* bsr */ |
|
64 #ifdef DEBUG_FLAG |
|
65 |
|
66 /*#define DEBUG(format, ...) \ |
|
67 gabble_debug(DEBUG_FLAG, "%s: " format, G_STRFUNC, ##__VA_ARGS__) |
|
68 */ |
|
69 |
|
70 #define DEBUG G_DEBUG |
|
71 static inline void G_DEBUG (const gchar *format, ...) |
|
72 { |
|
73 gabble_debug(DEBUG_FLAG, "%s: " format, G_STRFUNC, ##__VA_ARGS__) |
|
74 } |
|
75 |
|
76 #define DEBUGGING gabble_debug_flag_is_set(DEBUG_FLAG) |
|
77 |
|
78 #define NODE_DEBUG(n, s) \ |
|
79 G_STMT_START { \ |
|
80 gchar *debug_tmp = lm_message_node_to_string (n); \ |
|
81 gabble_debug (DEBUG_FLAG, "%s: " s ":\n%s", G_STRFUNC, debug_tmp); \ |
|
82 g_free (debug_tmp); \ |
|
83 } G_STMT_END |
|
84 |
|
85 #else /* DEBUG_FLAG */ |
|
86 #define DEBUG 0 |
|
87 #define DEBUGGING 0 |
|
88 #define NODE_DEBUG(n, s) |
|
89 #endif /* DEBUG_FLAG */ |
|
90 |
|
91 #else /* ENABLE_DEBUG */ |
|
92 |
|
93 #define DEBUG |
|
94 #define DEBUGGING 0 |
|
95 #define NODE_DEBUG(n, s) |
|
96 |
|
97 #endif /* ENABLE_DEBUG */ |
|
98 |
|
99 G_END_DECLS |
|
100 |
|
101 #endif |
|
102 |
|