ircu2.10.12 pk910 fork
[ircu2.10.12-pk.git] / include / s_debug.h
1 /* @file s_debug.h
2  * @brief Debug APIs for the ircd.
3  * @version $Id: s_debug.h 1231 2004-10-05 04:21:37Z entrope $
4  */
5 #ifndef INCLUDED_s_debug_h
6 #define INCLUDED_s_debug_h
7 #ifndef INCLUDED_config_h
8 #include "config.h"          /* Needed for DEBUGMODE */
9 #endif
10 #ifndef INCLUDED_ircd_defs_h
11 #include "ircd_defs.h"       /* Needed for HOSTLEN */
12 #endif
13 #ifndef INCLUDED_stdarg_h
14 #include <stdarg.h>
15 #define INCLUDED_stdarg_h
16 #endif
17
18 struct Client;
19 struct StatDesc;
20
21 #ifdef DEBUGMODE
22
23 /*
24  * Macro's
25  */
26
27 /** If DEBUGMODE is defined, output the debug message.
28  * @param x A two-or-more element list containing level, format and arguments.
29  */
30 #define Debug(x) debug x
31 #define LOGFILE LPATH /**< Path to debug log file. */
32
33 /*
34  * defined debugging levels
35  */
36 #define DEBUG_FATAL   0  /**< fatal error */
37 #define DEBUG_ERROR   1  /**< report_error() and other errors that are found */
38 #define DEBUG_NOTICE  3  /**< somewhat useful, but non-critical, messages */
39 #define DEBUG_DNS     4  /**< used by all DNS related routines - a *lot* */
40 #define DEBUG_INFO    5  /**< general useful info */
41 #define DEBUG_SEND    7  /**< everything that is sent out */
42 #define DEBUG_DEBUG   8  /**< everything that is received */ 
43 #define DEBUG_MALLOC  9  /**< malloc/free calls */
44 #define DEBUG_LIST   10  /**< debug list use */
45 #define DEBUG_ENGINE 11  /**< debug event engine; can dump gigabyte logs */
46
47 /*
48  * proto types
49  */
50
51 extern void vdebug(int level, const char *form, va_list vl);
52 extern void debug(int level, const char *form, ...);
53 extern void send_usage(struct Client *cptr, const struct StatDesc *sd,
54                        char *param);
55
56 #else /* !DEBUGMODE */
57
58 #define Debug(x)
59 #define LOGFILE "/dev/null"
60
61 #endif /* !DEBUGMODE */
62
63 extern const char* debug_serveropts(void);
64 extern void debug_init(int use_tty);
65 extern void count_memory(struct Client *cptr, const struct StatDesc *sd,
66                          char *param);
67
68 #endif /* INCLUDED_s_debug_h */