]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
b19ccc9e | 2 | * "$Id: debug.h 7701 2008-06-27 22:37:23Z mike $" |
ef416fc2 | 3 | * |
4 | * Debugging macros for the Common UNIX Printing System (CUPS). | |
5 | * | |
e07d4801 | 6 | * Copyright 2007-2009 by Apple Inc. |
ef416fc2 | 7 | * Copyright 1997-2005 by Easy Software Products. |
8 | * | |
9 | * These coded instructions, statements, and computer programs are the | |
bc44d920 | 10 | * property of Apple Inc. and are protected by Federal copyright |
11 | * law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
12 | * which should have been included with this file. If this file is | |
13 | * file is missing or damaged, see the license at "http://www.cups.org/". | |
ef416fc2 | 14 | * |
15 | * This file is subject to the Apple OS-Developed Software exception. | |
16 | */ | |
17 | ||
18 | #ifndef _CUPS_DEBUG_H_ | |
19 | # define _CUPS_DEBUG_H_ | |
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 | |
ef416fc2 | 57 | */ |
58 | ||
59 | # ifdef DEBUG | |
ae71f5de MS |
60 | # define DEBUG_puts(x) _cups_debug_puts(x) |
61 | # define DEBUG_printf(x) _cups_debug_printf x | |
ef416fc2 | 62 | # else |
63 | # define DEBUG_puts(x) | |
64 | # define DEBUG_printf(x) | |
65 | # endif /* DEBUG */ | |
66 | ||
ae71f5de MS |
67 | |
68 | /* | |
69 | * Prototypes... | |
70 | */ | |
71 | ||
4509bb49 | 72 | extern int _cups_debug_fd; |
f11a948a | 73 | extern int _cups_debug_level; |
ae71f5de MS |
74 | extern void _cups_debug_printf(const char *format, ...) |
75 | #ifdef __GNUC__ | |
76 | __attribute__ ((__format__ (__printf__, 1, 2))) | |
77 | #endif /* __GNUC__ */ | |
78 | ; | |
79 | extern void _cups_debug_puts(const char *s); | |
80 | ||
38e73f87 MS |
81 | # ifdef __cplusplus |
82 | } | |
83 | # endif /* __cplusplus */ | |
ae71f5de | 84 | |
ef416fc2 | 85 | #endif /* !_CUPS_DEBUG_H_ */ |
86 | ||
87 | /* | |
b19ccc9e | 88 | * End of "$Id: debug.h 7701 2008-06-27 22:37:23Z mike $". |
ef416fc2 | 89 | */ |