]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/debug-private.h
eccebcd2bf34b477a485d5b4f6e646000c7b8a3e
[thirdparty/cups.git] / cups / debug-private.h
1 /*
2 * Private debugging macros for CUPS.
3 *
4 * Copyright © 2007-2018 by Apple Inc.
5 * Copyright © 1997-2005 by Easy Software Products.
6 *
7 * Licensed under Apache License v2.0. See the file "LICENSE" for more
8 * information.
9 */
10
11 #ifndef _CUPS_DEBUG_PRIVATE_H_
12 # define _CUPS_DEBUG_PRIVATE_H_
13
14
15 /*
16 * Include necessary headers...
17 */
18
19 # include <cups/versioning.h>
20
21
22 /*
23 * C++ magic...
24 */
25
26 # ifdef __cplusplus
27 extern "C" {
28 # endif /* __cplusplus */
29
30
31 /*
32 * The debug macros are used if you compile with DEBUG defined.
33 *
34 * Usage:
35 *
36 * DEBUG_puts("string")
37 * DEBUG_printf(("format string", arg, arg, ...));
38 *
39 * Note the extra parenthesis around the DEBUG_printf macro...
40 *
41 * Newlines are not required on the end of messages, as both add one when
42 * writing the output.
43 *
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:
47 *
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
58 *
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.
62 */
63
64 # ifdef DEBUG
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)
68 # else
69 # define DLLExport
70 # define DEBUG_puts(x)
71 # define DEBUG_printf(x)
72 # define DEBUG_set(logfile,level,filter)
73 # endif /* DEBUG */
74
75
76 /*
77 * Prototypes...
78 */
79
80 extern int _cups_debug_fd _CUPS_PRIVATE;
81 extern int _cups_debug_level _CUPS_PRIVATE;
82 extern void _cups_debug_printf(const char *format, ...) _CUPS_FORMAT(1,2) _CUPS_PUBLIC;
83 extern void _cups_debug_puts(const char *s) _CUPS_PUBLIC;
84 extern void _cups_debug_set(const char *logfile, const char *level, const char *filter, int force) _CUPS_PUBLIC;
85 # ifdef WIN32
86 extern int _cups_gettimeofday(struct timeval *tv, void *tz) _CUPS_PRIVATE;
87 # define gettimeofday(a,b) _cups_gettimeofday(a, b)
88 # endif /* WIN32 */
89
90 # ifdef __cplusplus
91 }
92 # endif /* __cplusplus */
93
94 #endif /* !_CUPS_DEBUG_PRIVATE_H_ */