3 // Copyright (c) 2005 David Ward
5 #ifndef __Common_Trace_h__
6 #define __Common_Trace_h__
8 // Trace is a mechanism for printf-like debugging that can be switched on/off
11 // To use Trace, define DASHER_TRACE in your build files, or uncomment the
13 // #define DASHER_TRACE
15 // Use the DASHER_TRACEOUTPUT macro to format a message to trace
16 // Syntax is identicaly to printf:
19 // DASHER_TRACEOUTPUT("Hello World %d", i);
21 // The behaviour of DASHER_TRACEOUTPUT can be customized by changing
22 // DasherTraceOutputImpl in Trace.cpp
24 // Note that if DASHER_TRACE is not defined, trace code should be completely
25 // removed by the compiler
30 void DasherTraceOutput(const char *pszFormat
, ...);
31 void DasherTraceOutputImpl(const char *pszFormat
, va_list vargs
);
33 inline void DasherTraceOutput(const char *pszFormat
, ...) {
35 va_start(v
, pszFormat
);
36 DasherTraceOutputImpl(pszFormat
, v
);
40 // Define main Trace macro
45 #define DASHER_TRACEOUTPUT \
49 // Inactive - function should never get called
50 #define DASHER_TRACEOUTPUT 1 ? (void) 0 : DasherTraceOutput
52 #endif // DASHER_TRACE