updated Doxyfile
[strongswan.git] / src / libstrongswan / debug.h
1 /*
2 * Copyright (C) 2006 Martin Willi
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * $Id$
16 */
17
18 /**
19 * @defgroup debug debug
20 * @{ @ingroup libstrongswan
21 */
22
23 #ifndef DEBUG_H_
24 #define DEBUG_H_
25
26 #ifndef DEBUG_LEVEL
27 # define DEBUG_LEVEL 4
28 #endif /* DEBUG_LEVEL */
29
30 /** debug macros, they call the dbg function hook */
31 #if DEBUG_LEVEL >= 1
32 # define DBG1(fmt, ...) dbg(1, fmt, ##__VA_ARGS__)
33 #endif /* DEBUG_LEVEL */
34 #if DEBUG_LEVEL >= 2
35 # define DBG2(fmt, ...) dbg(2, fmt, ##__VA_ARGS__)
36 #endif /* DEBUG_LEVEL */
37 #if DEBUG_LEVEL >= 3
38 # define DBG3(fmt, ...) dbg(3, fmt, ##__VA_ARGS__)
39 #endif /* DEBUG_LEVEL */
40 #if DEBUG_LEVEL >= 4
41 # define DBG4(fmt, ...) dbg(4, fmt, ##__VA_ARGS__)
42 #endif /* DEBUG_LEVEL */
43
44 #ifndef DBG1
45 # define DBG1(...) {}
46 #endif
47 #ifndef DBG2
48 # define DBG2(...) {}
49 #endif
50 #ifndef DBG3
51 # define DBG3(...) {}
52 #endif
53 #ifndef DBG4
54 # define DBG4(...) {}
55 #endif
56
57 /** dbg function hook, uses stderr logger by default */
58 extern void (*dbg) (int level, char *fmt, ...);
59
60 /** default logging function, prints to stderr */
61 void dbg_default(int level, char *fmt, ...);
62
63 #endif /** DEBUG_H_ @}*/