fixed a crash when creating account
[empathy-mirror.git] / libempathy / empathy-debug.h
blob0a5c3f69707ca62f3d067a1b9a78f32f181188d0
1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
2 /*
3 * Copyright (C) 2007 Collabora Ltd.
4 * Copyright (C) 2007 Nokia Corporation
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef __EMPATHY_DEBUG_H__
22 #define __EMPATHY_DEBUG_H__
24 #include "config.h"
27 #include <glib.h>
28 #include <telepathy-glib/debug.h>
30 G_BEGIN_DECLS
32 /* Please keep this enum in sync with #keys in empathy-debug.c */
33 typedef enum
35 EMPATHY_DEBUG_TP = 1 << 1,
36 EMPATHY_DEBUG_CHAT = 1 << 2,
37 EMPATHY_DEBUG_CONTACT = 1 << 3,
38 EMPATHY_DEBUG_ACCOUNT = 1 << 4,
39 EMPATHY_DEBUG_IRC = 1 << 5,
40 EMPATHY_DEBUG_DISPATCHER = 1 << 6,
41 EMPATHY_DEBUG_FT = 1 << 7,
42 EMPATHY_DEBUG_LOCATION = 1 << 8,
43 EMPATHY_DEBUG_OTHER = 1 << 9,
44 EMPATHY_DEBUG_SHARE_DESKTOP = 1 << 10,
45 EMPATHY_DEBUG_CONNECTIVITY = 1 << 11,
46 EMPATHY_DEBUG_IMPORT_MC4_ACCOUNTS = 1 << 11,
47 EMPATHY_DEBUG_TESTS = 1 << 12,
48 EMPATHY_DEBUG_VOIP = 1 << 13,
49 } EmpathyDebugFlags;
51 gboolean empathy_debug_flag_is_set (EmpathyDebugFlags flag);
52 void empathy_debug (EmpathyDebugFlags flag, const gchar *format, ...)
53 G_GNUC_PRINTF (2, 3);
54 void empathy_debug_free (void);
55 void empathy_debug_set_flags (const gchar *flags_string);
56 G_END_DECLS
58 #endif /* __EMPATHY_DEBUG_H__ */
60 /* ------------------------------------ */
62 /* Below this point is outside the __DEBUG_H__ guard - so it can take effect
63 * more than once. So you can do:
65 * #define DEBUG_FLAG EMPATHY_DEBUG_ONE_THING
66 * #include "internal-debug.h"
67 * ...
68 * DEBUG ("if we're debugging one thing");
69 * ...
70 * #undef DEBUG_FLAG
71 * #define DEBUG_FLAG EMPATHY_DEBUG_OTHER_THING
72 * #include "internal-debug.h"
73 * ...
74 * DEBUG ("if we're debugging the other thing");
75 * ...
78 #ifdef DEBUG_FLAG
79 #ifdef ENABLE_DEBUG
81 #undef DEBUG
82 #define DEBUG(format, ...) \
83 empathy_debug (DEBUG_FLAG, "%s: " format, G_STRFUNC, ##__VA_ARGS__)
85 #undef DEBUGGING
86 #define DEBUGGING empathy_debug_flag_is_set (DEBUG_FLAG)
88 #else /* !defined (ENABLE_DEBUG) */
90 #undef DEBUG
91 #define DEBUG(format, ...) do {} while (0)
93 #undef DEBUGGING
94 #define DEBUGGING 0
96 #endif /* !defined (ENABLE_DEBUG) */
98 #define gabble_debug_free() G_STMT_START { } G_STMT_END
100 #endif /* defined (DEBUG_FLAG) */