2 * Copyright (C) 2007 Nokia Corporation
3 * Copyright (C) 2007-2011 Collabora Ltd.
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.
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.
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
29 /* Please keep this enum in sync with #keys in gcr-debug.c */
31 GCR_DEBUG_LIBRARY = 1 << 1,
32 GCR_DEBUG_CERTIFICATE_CHAIN = 1 << 2,
33 GCR_DEBUG_PARSE = 1 << 3,
36 gboolean _gcr_debug_flag_is_set (GcrDebugFlags flag);
38 void _gcr_debug_set_flags (const gchar *flags_string);
40 void _gcr_debug_message (GcrDebugFlags flag,
42 ...) G_GNUC_PRINTF (2, 3);
46 #endif /* GCR_DEBUG_H */
48 /* -----------------------------------------------------------------------------
49 * Below this point is outside the GCR_DEBUG_H guard - so it can take effect
50 * more than once. So you can do:
52 * #define DEBUG_FLAG GCR_DEBUG_ONE_THING
53 * #include "gcr-debug.h"
55 * DEBUG ("if we're debugging one thing");
58 * #define DEBUG_FLAG GCR_DEBUG_OTHER_THING
59 * #include "gcr-debug.h"
61 * DEBUG ("if we're debugging the other thing");
69 #define _gcr_debug(format, ...) \
70 _gcr_debug_message (DEBUG_FLAG, "%s: " format, G_STRFUNC, ##__VA_ARGS__)
73 #define _gcr_debugging \
74 _gcr_debug_flag_is_set (DEBUG_FLAG)
76 #else /* !defined (WITH_DEBUG) */
79 #define _gcr_debug(format, ...) \
83 #define _gcr_debugging 0
85 #endif /* !defined (WITH_DEBUG) */
87 #endif /* defined (DEBUG_FLAG) */