ITraceWriter::Trace Method

Invokes the specified traceAction to allow setting values in a new TraceRecord if and only if tracing is permitted at the given category and level.

Namespace:  System.Web.Http.Tracing
Assembly:  System.Web.Http (in System.Web.Http.dll)

void Trace(
	HttpRequestMessage^ request, 
	String^ category, 
	TraceLevel level, 
	Action<TraceRecord^>^ traceAction
)

Parameters

request
Type: HttpRequestMessage
The current HttpRequestMessage. It may be null but doing so will prevent subsequent trace analysis from correlating the trace to a particular request.
category
Type: System::String
The logical category for the trace. Users can define their own.
level
Type: System.Web.Http.Tracing::TraceLevel
The TraceLevel at which to write this trace.
traceAction
Type: System::Action<TraceRecord>
The action to invoke if tracing is enabled. The caller is expected to fill in the fields of the given TraceRecord in this action.

If tracing is permitted at the given category and level, the ITraceWriter will construct a TraceRecord and invoke the caller's action to allow it to set values in the TraceRecord provided to it. When the caller's action returns, the TraceRecord will be recorded. If tracing is not enabled, traceAction will not be called.

Show: