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