SourcePro® 2024.1 |
SourcePro® API Reference Guide |
A handle class for a single-client filter that lets events only of the supplied severity level or higher to pass through. More...
#include <rw/trace/RWTraceLevelFilter.h>
Additional Inherited Members | |
Protected Member Functions inherited from RWTraceEventClient | |
RWTraceEventClientImp * | getBody (void) const |
void | transfer (RWTraceEventClientImp *bodyP=0) |
RWTraceLevelFilter is a single-client trace filter that accepts events only of the supplied severity level or higher, and forwards them to a client.
This example is located in your installation directory at examples/trace/LevelFilter.cpp
.
//1
Compile in all trace macros by setting the user trace level macro to 8, the maximum (Entry/Exit) level. You can also define the trace level on the command line for your compiler, using the flag -DRW_USER_TRACE_LEVEL=8
.
//2
Declare the function as traceable, so you can use trace event generation macros in this function.
//3
Create a normal std::ostream client to display the trace information.
//4
Instantiate an RWTraceLevelFilter. The constructor takes the minimum severity (i.e. the maximum level) of trace messages to pass through. You can pass an integer level number cast to RWTraceEventSeverity or use one of the symbolic constants, as in this line. Pass RW_TRACE_LEVEL_NONE to filter out all trace messages. See the discussion on trace level filters in the Threads Module User's Guide for a definition of the severity levels.
//5
Connect the client to the level filter.
//6
Then connect the filter to the trace manager.
//7
Change the cutoff level on the level filter, using the setLevel() function.
All of these constants map directly to the appropriate severity level. RW_TRACE_LEVEL_NONE filters out all trace messages. It is equivalent to zero.
RWTraceLevelFilter::RWTraceLevelFilter | ( | ) |
Default constructor. The default level is RW_TRACE_LEVEL_NONE; no events are passed on.
RWTraceLevelFilter::RWTraceLevelFilter | ( | RWTraceEventSeverity | level | ) |
Constructs an instance with a severity filter level level.
RWTraceLevelFilter::RWTraceLevelFilter | ( | RWTraceLevelFilterImp * | bodyP | ) |
Attaches to and increments the reference count on bodyP.
RWTraceLevelFilter::RWTraceLevelFilter | ( | RWStaticCtor | ) |
Constructs a global static handle instance (that may be used before being constructed).
RWTraceLevelFilter::RWTraceLevelFilter | ( | const RWTraceLevelFilter & | second | ) |
Attaches to and increments the reference count on the body of second.
RWTraceLevelFilter::~RWTraceLevelFilter | ( | void | ) |
Destructor.
RWTraceEventSeverity RWTraceLevelFilter::getLevel | ( | ) | const |
Returns the filter's severity level.
void RWTraceLevelFilter::setLevel | ( | RWTraceEventSeverity | level | ) |
Sets the severity level for the filter.
Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |