]> git.0d.be Git - empathy.git/blob - libempathy/empathy-debug.h
Updated Swedish translation
[empathy.git] / libempathy / empathy-debug.h
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
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 <glib.h>
25 #include <telepathy-glib/telepathy-glib.h>
26
27 G_BEGIN_DECLS
28
29 /* Please keep this enum in sync with #keys in empathy-debug.c */
30 typedef enum
31 {
32   EMPATHY_DEBUG_TP = 1 << 1,
33   EMPATHY_DEBUG_CHAT = 1 << 2,
34   EMPATHY_DEBUG_CONTACT = 1 << 3,
35   EMPATHY_DEBUG_ACCOUNT = 1 << 4,
36   EMPATHY_DEBUG_DISPATCHER = 1 << 5,
37   EMPATHY_DEBUG_FT = 1 << 6,
38   EMPATHY_DEBUG_LOCATION = 1 << 7,
39   EMPATHY_DEBUG_OTHER = 1 << 8,
40   EMPATHY_DEBUG_SHARE_DESKTOP = 1 << 9,
41   EMPATHY_DEBUG_CONNECTIVITY = 1 << 10,
42   EMPATHY_DEBUG_IMPORT_MC4_ACCOUNTS = 1 << 10,
43   EMPATHY_DEBUG_TESTS = 1 << 11,
44   EMPATHY_DEBUG_VOIP = 1 << 12,
45   EMPATHY_DEBUG_TLS = 1 << 13,
46   EMPATHY_DEBUG_SASL = 1 << 14,
47   EMPATHY_DEBUG_CAMERA = 1 << 15,
48 } EmpathyDebugFlags;
49
50 gboolean empathy_debug_flag_is_set (EmpathyDebugFlags flag);
51 void empathy_debug (EmpathyDebugFlags flag, const gchar *format, ...)
52     G_GNUC_PRINTF (2, 3);
53 void empathy_debug_free (void);
54 void empathy_debug_set_flags (const gchar *flags_string);
55 G_END_DECLS
56
57 #endif /* __EMPATHY_DEBUG_H__ */
58
59 /* ------------------------------------ */
60
61 /* Below this point is outside the __DEBUG_H__ guard - so it can take effect
62  * more than once. So you can do:
63  *
64  * #define DEBUG_FLAG EMPATHY_DEBUG_ONE_THING
65  * #include "internal-debug.h"
66  * ...
67  * DEBUG ("if we're debugging one thing");
68  * ...
69  * #undef DEBUG_FLAG
70  * #define DEBUG_FLAG EMPATHY_DEBUG_OTHER_THING
71  * #include "internal-debug.h"
72  * ...
73  * DEBUG ("if we're debugging the other thing");
74  * ...
75  */
76
77 #ifdef DEBUG_FLAG
78 #ifdef ENABLE_DEBUG
79
80 #undef DEBUG
81 #define DEBUG(format, ...) \
82   empathy_debug (DEBUG_FLAG, "%s: " format, G_STRFUNC, ##__VA_ARGS__)
83
84 #undef DEBUGGING
85 #define DEBUGGING empathy_debug_flag_is_set (DEBUG_FLAG)
86
87 #else /* !defined (ENABLE_DEBUG) */
88
89 #undef DEBUG
90 #define DEBUG(format, ...) do {} while (0)
91
92 #undef DEBUGGING
93 #define DEBUGGING 0
94
95 #endif /* !defined (ENABLE_DEBUG) */
96
97 #define gabble_debug_free() G_STMT_START { } G_STMT_END
98
99 #endif /* defined (DEBUG_FLAG) */