]>
Commit | Line | Data |
---|---|---|
fb863569 MS |
1 | /* |
2 | * Internal debugging macros for CUPS. | |
3 | * | |
4 | * Copyright © 2007-2018 by Apple Inc. | |
5 | * Copyright © 1997-2005 by Easy Software Products. | |
6 | * | |
7 | * Licensed under Apache License v2.0. See the file "LICENSE" for more | |
8 | * information. | |
9 | */ | |
10 | ||
11 | #ifndef _CUPS_DEBUG_INTERNAL_H_ | |
12 | # define _CUPS_DEBUG_INTERNAL_H_ | |
13 | ||
14 | ||
15 | /* | |
16 | * Include necessary headers... | |
17 | */ | |
18 | ||
19 | # include "debug-private.h" | |
20 | ||
21 | ||
22 | /* | |
23 | * C++ magic... | |
24 | */ | |
25 | ||
26 | # ifdef __cplusplus | |
27 | extern "C" { | |
28 | # endif /* __cplusplus */ | |
29 | ||
30 | ||
31 | /* | |
32 | * The debug macros are used if you compile with DEBUG defined. | |
33 | * | |
34 | * Usage: | |
35 | * | |
36 | * DEBUG_puts("string") | |
37 | * DEBUG_printf(("format string", arg, arg, ...)); | |
38 | * | |
39 | * Note the extra parenthesis around the DEBUG_printf macro... | |
40 | * | |
41 | * Newlines are not required on the end of messages, as both add one when | |
42 | * writing the output. | |
43 | * | |
44 | * If the first character is a digit, then it represents the "log level" of the | |
45 | * message from 0 to 9. The default level is 1. The following defines the | |
46 | * current levels we use: | |
47 | * | |
48 | * 0 = public APIs, other than value accessor functions | |
49 | * 1 = return values for public APIs | |
50 | * 2 = public value accessor APIs, progress for public APIs | |
51 | * 3 = return values for value accessor APIs | |
52 | * 4 = private APIs, progress for value accessor APIs | |
53 | * 5 = return values for private APIs | |
54 | * 6 = progress for private APIs | |
55 | * 7 = static functions | |
56 | * 8 = return values for static functions | |
57 | * 9 = progress for static functions | |
58 | */ | |
59 | ||
60 | # ifdef DEBUG | |
61 | # define DEBUG_puts(x) _cups_debug_puts(x) | |
62 | # define DEBUG_printf(x) _cups_debug_printf x | |
63 | # else | |
64 | # define DEBUG_puts(x) | |
65 | # define DEBUG_printf(x) | |
66 | # endif /* DEBUG */ | |
67 | ||
68 | ||
69 | /* | |
70 | * Prototypes... | |
71 | */ | |
72 | ||
73 | # ifdef DEBUG | |
74 | extern int _cups_debug_fd _CUPS_INTERNAL; | |
75 | extern int _cups_debug_level _CUPS_INTERNAL; | |
76 | extern void _cups_debug_printf(const char *format, ...) _CUPS_FORMAT(1,2) _CUPS_INTERNAL; | |
77 | extern void _cups_debug_puts(const char *s) _CUPS_INTERNAL; | |
78 | # endif /* DEBUG */ | |
79 | ||
80 | # ifdef __cplusplus | |
81 | } | |
82 | # endif /* __cplusplus */ | |
83 | ||
84 | #endif /* !_CUPS_DEBUG_INTERNAL_H_ */ |