2 * Private debugging macros for CUPS.
4 * Copyright © 2007-2018 by Apple Inc.
5 * Copyright © 1997-2005 by Easy Software Products.
7 * Licensed under Apache License v2.0. See the file "LICENSE" for more
11 #ifndef _CUPS_DEBUG_PRIVATE_H_
12 # define _CUPS_DEBUG_PRIVATE_H_
16 * Include necessary headers...
19 # include <cups/versioning.h>
28 # endif /* __cplusplus */
32 * The debug macros are used if you compile with DEBUG defined.
36 * DEBUG_puts("string")
37 * DEBUG_printf(("format string", arg, arg, ...));
39 * Note the extra parenthesis around the DEBUG_printf macro...
41 * Newlines are not required on the end of messages, as both add one when
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:
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
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.
65 # define DEBUG_puts(x) _cups_debug_puts(x)
66 # define DEBUG_printf(x) _cups_debug_printf x
67 # define DEBUG_set(logfile,level,filter) _cups_debug_set(logfile,level,filter,1)
70 # define DEBUG_puts(x)
71 # define DEBUG_printf(x)
72 # define DEBUG_set(logfile,level,filter)
81 extern int _cups_debug_fd _CUPS_PRIVATE
;
82 extern int _cups_debug_level _CUPS_PRIVATE
;
83 extern void _cups_debug_printf(const char *format
, ...) _CUPS_FORMAT(1,2) _CUPS_PRIVATE
;
84 extern void _cups_debug_puts(const char *s
) _CUPS_PRIVATE
;
85 extern void _cups_debug_set(const char *logfile
, const char *level
, const char *filter
, int force
) _CUPS_PRIVATE
;
89 extern int _cups_gettimeofday(struct timeval
*tv
, void *tz
) _CUPS_PRIVATE
;
90 # define gettimeofday(a,b) _cups_gettimeofday(a, b)
95 # endif /* __cplusplus */
97 #endif /* !_CUPS_DEBUG_PRIVATE_H_ */