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/* 12285612Sdelphij * macro for debugging output - cut down on #ifdef pollution. 13285612Sdelphij * 14285612Sdelphij * TRACE() is similar to ntpd's DPRINTF() for utilities and libntp. 15285612Sdelphij * Uses mprintf() and so supports %m, replaced by strerror(errno). 16285612Sdelphij * 17285612Sdelphij * The calling convention is not attractive: 18285612Sdelphij * TRACE(debuglevel, (fmt, ...)); 19285612Sdelphij * TRACE(2, ("this will appear on stdout if debug >= %d\n", 2)); 20181834Sroberto */ 21285612Sdelphij#define TRACE(lvl, arg) \ 22200576Sroberto do { \ 23285612Sdelphij if (debug >= (lvl)) \ 24285612Sdelphij mprintf arg; \ 25200576Sroberto } while (0) 26181834Sroberto 27285612Sdelphij#endif /* NTP_DEBUG_H */ 28