Combining All Filtering Methods
The Execution Tracing package provides three ways of filtering by severity level to allow you the greatest flexibility in designing the tracing architecture for your applications. They were meant to be used together, and with the filtering of events by package, class and function using environment variables. The following sections detail some tracing scenarios that combine all the filtering mechanisms. You can use these as a basis for your systems.
Setup #1:
Set the RW_USER_TRACE_LEVEL macro to 8 to compile in all macros and use the RW_TRACE_LEVEL environment variable to control trace output. Don’t use a level filter. This setup provides enough control for most systems, and it doesn’t require the added complexity of inserting a level filter into your application.
Setup #2:
Set the RW_USER_TRACE_LEVEL macro to 3 (ERROR), don’t set the RW_TRACE_LEVEL environment variable, and use an RWTraceOstreamClient to log all events to a file. This setup could be used for the release version of a product. FATAL and ERROR messages are logged to a file, which can be emailed to your support staff to aid in fixing bugs in your product. You could even create a client that opens a socket and automatically emails any FATAL and ERROR messages to your support email address over the Internet.
Setup #3:
Set the RW_USER_TRACE_LEVEL macro to 0. This compiles out all trace macros. Use this setup for fully-debugged release versions of software, where execution speed is paramount.