153553Stanimura/*
253553Stanimura * $Header$
353553Stanimura *
453553Stanimura * $Created: Sat Aug 20 14:23:01 2005 $
553553Stanimura *
653553Stanimura * Copyright (C) 2005 by Frank Kardel
753553Stanimura */
853553Stanimura#ifndef NTP_DEBUG_H
953553Stanimura#define NTP_DEBUG_H
1053553Stanimura
1153553Stanimura/*
1253553Stanimura * macro for debugging output - cut down on #ifdef pollution.
1353553Stanimura *
1453553Stanimura * TRACE() is similar to ntpd's DPRINTF() for utilities and libntp.
1553553Stanimura * Uses mprintf() and so supports %m, replaced by strerror(errno).
1653553Stanimura *
1753553Stanimura * The calling convention is not attractive:
1853553Stanimura *     TRACE(debuglevel, (fmt, ...));
1953553Stanimura *     TRACE(2, ("this will appear on stdout if debug >= %d\n", 2));
2053553Stanimura */
2153553Stanimura#define TRACE(lvl, arg)					\
2253553Stanimura	do { 						\
2353553Stanimura		if (debug >= (lvl))			\
2453553Stanimura			mprintf arg;			\
2553553Stanimura	} while (0)
2653553Stanimura
2753553Stanimura#endif	/* NTP_DEBUG_H */
2853553Stanimura