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/* 12290001Sglebius * macro for debugging output - cut down on #ifdef pollution. 13290001Sglebius * 14290001Sglebius * TRACE() is similar to ntpd's DPRINTF() for utilities and libntp. 15290001Sglebius * Uses mprintf() and so supports %m, replaced by strerror(errno). 16290001Sglebius * 17290001Sglebius * The calling convention is not attractive: 18290001Sglebius * TRACE(debuglevel, (fmt, ...)); 19290001Sglebius * TRACE(2, ("this will appear on stdout if debug >= %d\n", 2)); 20181834Sroberto */ 21290001Sglebius#define TRACE(lvl, arg) \ 22200576Sroberto do { \ 23290001Sglebius if (debug >= (lvl)) \ 24290001Sglebius mprintf arg; \ 25200576Sroberto } while (0) 26181834Sroberto 27290001Sglebius#endif /* NTP_DEBUG_H */ 28