]> git.0d.be Git - empathy.git/blob - libempathy/empathy-debug.h
Keypad is unsensitive if the call is not ACCEPTED
[empathy.git] / libempathy / empathy-debug.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2007 Collabora Ltd.
4  * Copyright (C) 2007 Nokia Corporation
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #ifndef __EMPATHY_DEBUG_H__
22 #define __EMPATHY_DEBUG_H__
23
24 #include "config.h"
25
26
27 #include <glib.h>
28 #include <telepathy-glib/debug.h>
29
30 G_BEGIN_DECLS
31
32 #ifdef ENABLE_DEBUG
33
34 /* Please keep this enum in sync with #keys in empathy-debug.c */
35 typedef enum
36 {
37   EMPATHY_DEBUG_TP = 1 << 1,
38   EMPATHY_DEBUG_CHAT = 1 << 2,
39   EMPATHY_DEBUG_CONTACT = 1 << 3,
40   EMPATHY_DEBUG_ACCOUNT = 1 << 4,
41   EMPATHY_DEBUG_IRC = 1 << 5,
42   EMPATHY_DEBUG_FILTER = 1 << 6,
43   EMPATHY_DEBUG_OTHER = 1 << 7,
44 } EmpathyDebugFlags;
45
46 gboolean empathy_debug_flag_is_set (EmpathyDebugFlags flag);
47 void empathy_debug (EmpathyDebugFlags flag, const gchar *format, ...)
48     G_GNUC_PRINTF (2, 3);
49
50 #endif /* ENABLE_DEBUG */
51
52 void empathy_debug_set_flags (const gchar *flags_string);
53 G_END_DECLS
54
55 #endif /* __EMPATHY_DEBUG_H__ */
56
57 /* ------------------------------------ */
58
59 /* Below this point is outside the __DEBUG_H__ guard - so it can take effect
60  * more than once. So you can do:
61  *
62  * #define DEBUG_FLAG EMPATHY_DEBUG_ONE_THING
63  * #include "internal-debug.h"
64  * ...
65  * DEBUG ("if we're debugging one thing");
66  * ...
67  * #undef DEBUG_FLAG
68  * #define DEBUG_FLAG EMPATHY_DEBUG_OTHER_THING
69  * #include "internal-debug.h"
70  * ...
71  * DEBUG ("if we're debugging the other thing");
72  * ...
73  */
74
75 #ifdef DEBUG_FLAG
76 #ifdef ENABLE_DEBUG
77
78 #undef DEBUG
79 #define DEBUG(format, ...) \
80   empathy_debug (DEBUG_FLAG, "%s: " format, G_STRFUNC, ##__VA_ARGS__)
81
82 #undef DEBUGGING
83 #define DEBUGGING empathy_debug_flag_is_set (DEBUG_FLAG)
84
85 #else /* !defined (ENABLE_DEBUG) */
86
87 #undef DEBUG
88 #define DEBUG(format, ...) do {} while (0)
89
90 #undef DEBUGGING
91 #define DEBUGGING 0
92
93 #endif /* !defined (ENABLE_DEBUG) */
94 #endif /* defined (DEBUG_FLAG) */