1181834Sroberto/*
2181834Sroberto * $Header$
3181834Sroberto *
4181834Sroberto * $Created: Sat Aug 20 14:23:01 2005 $
5181834Sroberto *
6181834Sroberto * Copyright (C) 2005 by Frank Kardel
7181834Sroberto */
8181834Sroberto#ifndef NTP_DEBUG_H
9181834Sroberto#define NTP_DEBUG_H
10181834Sroberto
11181834Sroberto/*
12280849Scy * macro for debugging output - cut down on #ifdef pollution.
13280849Scy *
14280849Scy * TRACE() is similar to ntpd's DPRINTF() for utilities and libntp.
15280849Scy * Uses mprintf() and so supports %m, replaced by strerror(errno).
16280849Scy *
17280849Scy * The calling convention is not attractive:
18280849Scy *     TRACE(debuglevel, (fmt, ...));
19280849Scy *     TRACE(2, ("this will appear on stdout if debug >= %d\n", 2));
20181834Sroberto */
21280849Scy#define TRACE(lvl, arg)					\
22200576Sroberto	do { 						\
23280849Scy		if (debug >= (lvl))			\
24280849Scy			mprintf arg;			\
25200576Sroberto	} while (0)
26181834Sroberto
27280849Scy#endif	/* NTP_DEBUG_H */
28