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