2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or (at
5 * your option) any later version.
7 * This program is distributed in the hope that it will be useful, but
8 * WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * Copyright © 2006 Pierre Habouzit
20 * written for mutt-ng by:
21 * Rocco Rutte <pdmef@cs.tu-berlin.de>
23 * This file is part of mutt-ng, see http://www.muttng.org/.
24 * It's licensed under the GNU General Public License,
25 * please see the file GPL in the top level source directory.
28 /* generic interface for debug messages */
30 #ifndef MUTT_LIB_LIB_DEBUG_H
31 #define MUTT_LIB_LIB_DEBUG_H
35 #define DEBUG_MIN_LEVEL 1
36 #define DEBUG_MIN_LEVEL_S "1"
37 #define DEBUG_MAX_LEVEL 5
38 #define DEBUG_MAX_LEVEL_S "5"
42 extern short DebugLevel;
43 extern FILE* DebugFile;
45 void debug_setlevel (short);
46 void debug_start (const char*);
48 void _debug_print_intro (const char*, int, const char*, int);
49 void _debug_print_msg (const char*, ...);
52 * the debug_print() macro will (in the end) print debug messages of the
55 * (file:line:function:level): message
59 * (file:line:level): message
65 #define debug_print(level,msg) \
67 if (DebugLevel >= level) { \
68 _debug_print_intro (__FILE__,__LINE__,__func__,level); \
69 _debug_print_msg msg; \
75 #define debug_print(level,msg) \
77 if (DebugLevel >= level) { \
78 _debug_print_intro (__FILE__,__LINE__,NULL,level); \
79 _debug_print_msg msg; \
83 #endif /* !__GNUC__ */
88 * without debug support, we don't need these
89 * (this also kills the dozens of #ifdef for debug...
91 #define debug_start(basedir)
92 #define debug_setlevel(level)
93 #define debug_print(level,msg)
97 #endif /* MUTT_LIB_LIB_DEBUG_H */