xref: /freebsd/contrib/ntp/include/ntp_debug.h (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1 /*
2  * $Header$
3  *
4  * $Created: Sat Aug 20 14:23:01 2005 $
5  *
6  * Copyright (C) 2005 by Frank Kardel
7  */
8 #ifndef NTP_DEBUG_H
9 #define NTP_DEBUG_H
10 
11 /*
12  * macro for debugging output - cut down on #ifdef pollution.
13  *
14  * TRACE() is similar to ntpd's DPRINTF() for utilities and libntp.
15  * Uses mprintf() and so supports %m, replaced by strerror(errno).
16  *
17  * The calling convention is not attractive:
18  *     TRACE(debuglevel, (fmt, ...));
19  *     TRACE(2, ("this will appear on stdout if debug >= %d\n", 2));
20  */
21 #define TRACE(lvl, arg)					\
22 	do { 						\
23 		if (debug >= (lvl))			\
24 			mprintf arg;			\
25 	} while (0)
26 
27 #endif	/* NTP_DEBUG_H */
28