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