]> git.ipfire.org Git - thirdparty/cups.git/blame - cups/debug-private.h
Merge changes from CUPS 1.6svn-r9968.
[thirdparty/cups.git] / cups / debug-private.h
CommitLineData
ef416fc2 1/*
71e16022 2 * "$Id$"
ef416fc2 3 *
71e16022 4 * Private debugging macros for CUPS.
ef416fc2 5 *
71e16022 6 * Copyright 2007-2010 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
71e16022
MS
18#ifndef _CUPS_DEBUG_PRIVATE_H_
19# define _CUPS_DEBUG_PRIVATE_H_
ef416fc2 20
85dda01c
MS
21
22/*
23 * Include necessary headers...
24 */
25
26# include <cups/versioning.h>
27
28
38e73f87
MS
29/*
30 * C++ magic...
31 */
32
33# ifdef __cplusplus
34extern "C" {
35# endif /* __cplusplus */
36
37
ef416fc2 38/*
39 * The debug macros are used if you compile with DEBUG defined.
40 *
41 * Usage:
42 *
43 * DEBUG_puts("string")
44 * DEBUG_printf(("format string", arg, arg, ...));
45 *
46 * Note the extra parenthesis around the DEBUG_printf macro...
e07d4801
MS
47 *
48 * Newlines are not required on the end of messages, as both add one when
49 * writing the output.
50 *
51 * If the first character is a digit, then it represents the "log level" of the
52 * message from 0 to 9. The default level is 1. The following defines the
53 * current levels we use:
54 *
55 * 0 = public APIs, other than value accessor functions
56 * 1 = return values for public APIs
57 * 2 = public value accessor APIs, progress for public APIs
58 * 3 = return values for value accessor APIs
59 * 4 = private APIs, progress for value accessor APIs
60 * 5 = return values for private APIs
61 * 6 = progress for private APIs
62 * 7 = static functions
63 * 8 = return values for static functions
64 * 9 = progress for static functions
7cf5915e
MS
65 *
66 * The DEBUG_set macro allows an application to programmatically enable (or
67 * disable) debug logging. The arguments correspond to the CUPS_DEBUG_LOG,
68 * CUPS_DEBUG_LEVEL, and CUPS_DEBUG_FILTER environment variables.
ef416fc2 69 */
70
71# ifdef DEBUG
7cf5915e
MS
72# ifdef WIN32
73# ifdef LIBCUPS2_EXPORTS
74# define DLLExport __declspec(dllexport)
75# else
76# define DLLExport
77# endif /* LIBCUPS2_EXPORTS */
78# else
79# define DLLExport
80# endif /* WIN32 */
ae71f5de
MS
81# define DEBUG_puts(x) _cups_debug_puts(x)
82# define DEBUG_printf(x) _cups_debug_printf x
7cf5915e 83# define DEBUG_set(logfile,level,filter) _cups_debug_set(logfile,level,filter,1)
ef416fc2 84# else
7cf5915e 85# define DLLExport
ef416fc2 86# define DEBUG_puts(x)
87# define DEBUG_printf(x)
7cf5915e 88# define DEBUG_set(logfile,level,filter)
ef416fc2 89# endif /* DEBUG */
90
ae71f5de
MS
91
92/*
93 * Prototypes...
94 */
95
4509bb49 96extern int _cups_debug_fd;
f11a948a 97extern int _cups_debug_level;
7cf5915e 98extern void DLLExport _cups_debug_printf(const char *format, ...)
85dda01c 99 __attribute__ ((__format__ (__printf__, 1, 2)));
7cf5915e
MS
100extern void DLLExport _cups_debug_puts(const char *s);
101extern void DLLExport _cups_debug_set(const char *logfile,
102 const char *level, const char *filter,
103 int force);
ae71f5de 104
38e73f87
MS
105# ifdef __cplusplus
106}
107# endif /* __cplusplus */
ae71f5de 108
71e16022 109#endif /* !_CUPS_DEBUG_PRIVATE_H_ */
ef416fc2 110
111/*
71e16022 112 * End of "$Id$".
ef416fc2 113 */