The RW_USER_TRACE_LEVEL Macro
The first method is the
RW_USER_TRACE_LEVEL macro. This macro must be defined before the
rw/trace/trace.h header file is included, either in your code or on the command line for your compiler. The macro is set to a number between 0 and 8, with 0 meaning “compile out all trace macros” and levels 2 through 8 corresponding to severity levels discussed in
Trace Severity Levels.
The RW_USER_TRACE_LEVEL macro determines which event generation macros are actually compiled into your code. The default level is 5 (INFO). If you don’t compile in a particular trace level, you can’t filter it using either of the two methods that follow. For this reason, you may want to define this macro to 8 to compile in all macros and then use one of the methods that follow to control the filtering at runtime. The runtime filtering methods are computationally more expensive than filtering at compile time, because trace events are still generated at runtime and just filtered out, whereas with compile-time filtering, they are never even generated.