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)

Syntax

'Declaration
Sub Trace ( _
    request As HttpRequestMessage, _
    category As String, _
    level As TraceLevel, _
    traceAction As Action(Of TraceRecord) _
)
'Usage
Dim instance As ITraceWriter 
Dim request As HttpRequestMessage 
Dim category As String 
Dim level As TraceLevel 
Dim traceAction As Action(Of TraceRecord)

instance.Trace(request, category, level, _
    traceAction)
void Trace(
    HttpRequestMessage request,
    string category,
    TraceLevel level,
    Action<TraceRecord> traceAction
)
void Trace(
    HttpRequestMessage^ request, 
    String^ category, 
    TraceLevel level, 
    Action<TraceRecord^>^ traceAction
)
abstract Trace : 
        request:HttpRequestMessage * 
        category:string * 
        level:TraceLevel * 
        traceAction:Action<TraceRecord> -> unit
function Trace(
    request : HttpRequestMessage, 
    category : String, 
    level : TraceLevel, 
    traceAction : Action<TraceRecord>
)

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.

  • 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.

Remarks

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.

See Also

Reference

ITraceWriter Interface

System.Web.Http.Tracing Namespace