I wonder, what is the best trace technique for you. Currently, I am defining trace level for each source witch macro just before including trace header, which is using defined macro.
For example: trace.h:
#if DEBUG == 0
#define debug(...)
#define trace(...)
#elif DEBUG==1
#define debug(...)
#define trace(...) printf(__VA_ARGS__)
#elif DEBUG==2
#define debug(...) printf(__VA_ARGS__)
#define trace(...) printf(__VA_ARGS__)
#else
#error Bad DEBUG value
#endif
For all sources.c (trace_value varies)
#define DEBUG trace_value
#include "trace.h"
void func(){
debug("func()");
trace("func() ok");
reurn;
}
However, project grows and I want to use precompiled header. It would be great to include trace header in my precompiled header. So I am wondering, what are your trace techniques? Thank you.
EDIT: I forgot to write important thing, I am interested in logging technique for latency critical application.