]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
503b54c9 | 2 | * Private debugging macros for CUPS. |
ef416fc2 | 3 | * |
2c48abc6 | 4 | * Copyright 2007-2018 by Apple Inc. |
503b54c9 | 5 | * Copyright 1997-2005 by Easy Software Products. |
ef416fc2 | 6 | * |
503b54c9 MS |
7 | * These coded instructions, statements, and computer programs are the |
8 | * property of Apple Inc. and are protected by Federal copyright | |
9 | * law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
10 | * which should have been included with this file. If this file is | |
57b7b66b | 11 | * missing or damaged, see the license at "http://www.cups.org/". |
ef416fc2 | 12 | * |
503b54c9 | 13 | * This file is subject to the Apple OS-Developed Software exception. |
ef416fc2 | 14 | */ |
15 | ||
71e16022 MS |
16 | #ifndef _CUPS_DEBUG_PRIVATE_H_ |
17 | # define _CUPS_DEBUG_PRIVATE_H_ | |
ef416fc2 | 18 | |
85dda01c MS |
19 | |
20 | /* | |
21 | * Include necessary headers... | |
22 | */ | |
23 | ||
24 | # include <cups/versioning.h> | |
25 | ||
26 | ||
38e73f87 MS |
27 | /* |
28 | * C++ magic... | |
29 | */ | |
30 | ||
31 | # ifdef __cplusplus | |
32 | extern "C" { | |
33 | # endif /* __cplusplus */ | |
34 | ||
35 | ||
ef416fc2 | 36 | /* |
37 | * The debug macros are used if you compile with DEBUG defined. | |
38 | * | |
39 | * Usage: | |
40 | * | |
41 | * DEBUG_puts("string") | |
42 | * DEBUG_printf(("format string", arg, arg, ...)); | |
43 | * | |
44 | * Note the extra parenthesis around the DEBUG_printf macro... | |
e07d4801 MS |
45 | * |
46 | * Newlines are not required on the end of messages, as both add one when | |
47 | * writing the output. | |
48 | * | |
49 | * If the first character is a digit, then it represents the "log level" of the | |
50 | * message from 0 to 9. The default level is 1. The following defines the | |
51 | * current levels we use: | |
52 | * | |
53 | * 0 = public APIs, other than value accessor functions | |
54 | * 1 = return values for public APIs | |
55 | * 2 = public value accessor APIs, progress for public APIs | |
56 | * 3 = return values for value accessor APIs | |
57 | * 4 = private APIs, progress for value accessor APIs | |
58 | * 5 = return values for private APIs | |
59 | * 6 = progress for private APIs | |
60 | * 7 = static functions | |
61 | * 8 = return values for static functions | |
62 | * 9 = progress for static functions | |
7cf5915e MS |
63 | * |
64 | * The DEBUG_set macro allows an application to programmatically enable (or | |
65 | * disable) debug logging. The arguments correspond to the CUPS_DEBUG_LOG, | |
66 | * CUPS_DEBUG_LEVEL, and CUPS_DEBUG_FILTER environment variables. | |
ef416fc2 | 67 | */ |
68 | ||
69 | # ifdef DEBUG | |
ae71f5de MS |
70 | # define DEBUG_puts(x) _cups_debug_puts(x) |
71 | # define DEBUG_printf(x) _cups_debug_printf x | |
7cf5915e | 72 | # define DEBUG_set(logfile,level,filter) _cups_debug_set(logfile,level,filter,1) |
ef416fc2 | 73 | # else |
74 | # define DEBUG_puts(x) | |
75 | # define DEBUG_printf(x) | |
7cf5915e | 76 | # define DEBUG_set(logfile,level,filter) |
ef416fc2 | 77 | # endif /* DEBUG */ |
78 | ||
ae71f5de MS |
79 | |
80 | /* | |
81 | * Prototypes... | |
82 | */ | |
83 | ||
4509bb49 | 84 | extern int _cups_debug_fd; |
f11a948a | 85 | extern int _cups_debug_level; |
2c48abc6 MS |
86 | extern void _cups_debug_printf(const char *format, ...) _CUPS_FORMAT(1, 2); |
87 | extern void _cups_debug_puts(const char *s); | |
88 | extern void _cups_debug_set(const char *logfile, const char *level, const char *filter, int force) _CUPS_PRIVATE; | |
0313a59e | 89 | # ifdef _WIN32 |
2c48abc6 | 90 | extern int _cups_gettimeofday(struct timeval *tv, void *tz) _CUPS_PRIVATE; |
12f89d24 | 91 | # define gettimeofday(a,b) _cups_gettimeofday(a, b) |
0313a59e | 92 | # endif /* _WIN32 */ |
ae71f5de | 93 | |
38e73f87 MS |
94 | # ifdef __cplusplus |
95 | } | |
96 | # endif /* __cplusplus */ | |
ae71f5de | 97 | |
71e16022 | 98 | #endif /* !_CUPS_DEBUG_PRIVATE_H_ */ |