]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
503b54c9 | 2 | * Private debugging macros for CUPS. |
ef416fc2 | 3 | * |
be3b49a3 MS |
4 | * Copyright © 2007-2018 by Apple Inc. |
5 | * Copyright © 1997-2005 by Easy Software Products. | |
ef416fc2 | 6 | * |
be3b49a3 MS |
7 | * Licensed under Apache License v2.0. See the file "LICENSE" for more |
8 | * information. | |
ef416fc2 | 9 | */ |
10 | ||
71e16022 MS |
11 | #ifndef _CUPS_DEBUG_PRIVATE_H_ |
12 | # define _CUPS_DEBUG_PRIVATE_H_ | |
ef416fc2 | 13 | |
85dda01c MS |
14 | |
15 | /* | |
16 | * Include necessary headers... | |
17 | */ | |
18 | ||
19 | # include <cups/versioning.h> | |
20 | ||
21 | ||
38e73f87 MS |
22 | /* |
23 | * C++ magic... | |
24 | */ | |
25 | ||
26 | # ifdef __cplusplus | |
27 | extern "C" { | |
28 | # endif /* __cplusplus */ | |
29 | ||
30 | ||
ef416fc2 | 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... | |
e07d4801 MS |
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 | |
7cf5915e MS |
58 | * |
59 | * The DEBUG_set macro allows an application to programmatically enable (or | |
60 | * disable) debug logging. The arguments correspond to the CUPS_DEBUG_LOG, | |
61 | * CUPS_DEBUG_LEVEL, and CUPS_DEBUG_FILTER environment variables. | |
ef416fc2 | 62 | */ |
63 | ||
64 | # ifdef DEBUG | |
ae71f5de MS |
65 | # define DEBUG_puts(x) _cups_debug_puts(x) |
66 | # define DEBUG_printf(x) _cups_debug_printf x | |
7cf5915e | 67 | # define DEBUG_set(logfile,level,filter) _cups_debug_set(logfile,level,filter,1) |
ef416fc2 | 68 | # else |
7cf5915e | 69 | # define DLLExport |
ef416fc2 | 70 | # define DEBUG_puts(x) |
71 | # define DEBUG_printf(x) | |
7cf5915e | 72 | # define DEBUG_set(logfile,level,filter) |
ef416fc2 | 73 | # endif /* DEBUG */ |
74 | ||
ae71f5de MS |
75 | |
76 | /* | |
77 | * Prototypes... | |
78 | */ | |
79 | ||
be3b49a3 MS |
80 | extern int _cups_debug_fd _CUPS_PRIVATE; |
81 | extern int _cups_debug_level _CUPS_PRIVATE; | |
82 | extern void _cups_debug_printf(const char *format, ...) _CUPS_FORMAT(1,2) _CUPS_PUBLIC; | |
83 | extern void _cups_debug_puts(const char *s) _CUPS_PUBLIC; | |
84 | extern void _cups_debug_set(const char *logfile, const char *level, const char *filter, int force) _CUPS_PUBLIC; | |
19dc16f7 | 85 | # ifdef _WIN32 |
be3b49a3 | 86 | extern int _cups_gettimeofday(struct timeval *tv, void *tz) _CUPS_PRIVATE; |
12f89d24 | 87 | # define gettimeofday(a,b) _cups_gettimeofday(a, b) |
19dc16f7 | 88 | # endif /* _WIN32 */ |
ae71f5de | 89 | |
38e73f87 MS |
90 | # ifdef __cplusplus |
91 | } | |
92 | # endif /* __cplusplus */ | |
ae71f5de | 93 | |
71e16022 | 94 | #endif /* !_CUPS_DEBUG_PRIVATE_H_ */ |