1 /*
2  * libdpkg - Debian packaging suite library routines
3  * debug.h - debugging support
4  *
5  * Copyright © 2011 Guillem Jover <guillem@debian.org>
6  *
7  * This is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef LIBDPKG_DEBUG_H
22 #define LIBDPKG_DEBUG_H
23 
24 #include <dpkg/macros.h>
25 
26 #include <stdbool.h>
27 #include <stdio.h>
28 
29 DPKG_BEGIN_DECLS
30 
31 /**
32  * @defgroup debug Debugging
33  * @ingroup dpkg-internal
34  * @{
35  */
36 
37 /*
38  * XXX: We do not use DPKG_BIT() here, because the octal values are part
39  * of the current output interface.
40  */
41 enum debugflags {
42 	dbg_general = 01,
43 	dbg_scripts = 02,
44 	dbg_eachfile = 010,
45 	dbg_eachfiledetail = 0100,
46 	dbg_conff = 020,
47 	dbg_conffdetail = 0200,
48 	dbg_depcon = 040,
49 	dbg_depcondetail = 0400,
50 	dbg_veryverbose = 01000,
51 	dbg_stupidlyverbose = 02000,
52 	dbg_triggers = 010000,
53 	dbg_triggersdetail = 020000,
54 	dbg_triggersstupid = 040000,
55 };
56 
57 void debug_set_output(FILE *output, const char *filename);
58 void debug_set_mask(int mask);
59 bool debug_has_flag(int flag);
60 void debug(int flag, const char *fmt, ...) DPKG_ATTR_PRINTF(2);
61 
62 /** @} */
63 
64 DPKG_END_DECLS
65 
66 #endif /* LIBDPKG_DEBUG_H */
67