1*cdfa2a7eSchristos /* $NetBSD: ntp_debug.h,v 1.6 2020/05/25 20:47:19 christos Exp $ */ 2abb0f93cSkardel 3abb0f93cSkardel /* 4f003fb54Skardel * Header 5abb0f93cSkardel * 679045f13Schristos * Created 7abb0f93cSkardel * 8abb0f93cSkardel * Copyright (C) 2005 by Frank Kardel 9abb0f93cSkardel */ 10abb0f93cSkardel #ifndef NTP_DEBUG_H 11abb0f93cSkardel #define NTP_DEBUG_H 12abb0f93cSkardel 13abb0f93cSkardel /* 148585484eSchristos * macro for debugging output - cut down on #ifdef pollution. 158585484eSchristos * 168585484eSchristos * TRACE() is similar to ntpd's DPRINTF() for utilities and libntp. 178585484eSchristos * Uses mprintf() and so supports %m, replaced by strerror(errno). 188585484eSchristos * 198585484eSchristos * The calling convention is not attractive: 208585484eSchristos * TRACE(debuglevel, (fmt, ...)); 218585484eSchristos * TRACE(2, ("this will appear on stdout if debug >= %d\n", 2)); 22abb0f93cSkardel */ 238585484eSchristos #define TRACE(lvl, arg) \ 24abb0f93cSkardel do { \ 258585484eSchristos if (debug >= (lvl)) \ 268585484eSchristos mprintf arg; \ 27abb0f93cSkardel } while (0) 28abb0f93cSkardel 298585484eSchristos #endif /* NTP_DEBUG_H */ 30