Freigeben über


ITraceWriterExtensions.TraceBeginEnd Method

Traces both a begin and an end trace around a specified operation.

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

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Sub TraceBeginEnd ( _
    traceWriter As ITraceWriter, _
    request As HttpRequestMessage, _
    category As String, _
    level As TraceLevel, _
    operatorName As String, _
    operationName As String, _
    beginTrace As Action(Of TraceRecord), _
    execute As Action, _
    endTrace As Action(Of TraceRecord), _
    errorTrace As Action(Of TraceRecord) _
)
'Usage
Dim traceWriter As ITraceWriter 
Dim request As HttpRequestMessage 
Dim category As String 
Dim level As TraceLevel 
Dim operatorName As String 
Dim operationName As String 
Dim beginTrace As Action(Of TraceRecord)
Dim execute As Action 
Dim endTrace As Action(Of TraceRecord)
Dim errorTrace As Action(Of TraceRecord)

traceWriter.TraceBeginEnd(request, _
    category, level, operatorName, operationName, _
    beginTrace, execute, endTrace, errorTrace)
public static void TraceBeginEnd(
    this ITraceWriter traceWriter,
    HttpRequestMessage request,
    string category,
    TraceLevel level,
    string operatorName,
    string operationName,
    Action<TraceRecord> beginTrace,
    Action execute,
    Action<TraceRecord> endTrace,
    Action<TraceRecord> errorTrace
)
[ExtensionAttribute]
public:
static void TraceBeginEnd(
    ITraceWriter^ traceWriter, 
    HttpRequestMessage^ request, 
    String^ category, 
    TraceLevel level, 
    String^ operatorName, 
    String^ operationName, 
    Action<TraceRecord^>^ beginTrace, 
    Action^ execute, 
    Action<TraceRecord^>^ endTrace, 
    Action<TraceRecord^>^ errorTrace
)
static member TraceBeginEnd : 
        traceWriter:ITraceWriter * 
        request:HttpRequestMessage * 
        category:string * 
        level:TraceLevel * 
        operatorName:string * 
        operationName:string * 
        beginTrace:Action<TraceRecord> * 
        execute:Action * 
        endTrace:Action<TraceRecord> * 
        errorTrace:Action<TraceRecord> -> unit
public static function TraceBeginEnd(
    traceWriter : ITraceWriter, 
    request : HttpRequestMessage, 
    category : String, 
    level : TraceLevel, 
    operatorName : String, 
    operationName : String, 
    beginTrace : Action<TraceRecord>, 
    execute : Action, 
    endTrace : Action<TraceRecord>, 
    errorTrace : Action<TraceRecord>
)

Parameters

  • request
    Type: HttpRequestMessage

    The HttpRequestMessage with which to associate the trace. It may be null.

  • category
    Type: System.String

    The logical category of the trace.

  • operatorName
    Type: System.String

    The name of the object performing the operation. It may be null.

  • operationName
    Type: System.String

    The name of the operation being performed. It may be null.

  • execute
    Type: System.Action

    An <see cref="T:System.Func`1" /> that returns the Task that will perform the operation.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ITraceWriter. When you use instance method syntax to call this method, omit the first parameter. For more information, see https://msdn.microsoft.com/en-us/library/bb384936(v=vs.108) or https://msdn.microsoft.com/en-us/library/bb383977(v=vs.108).

See Also

Reference

ITraceWriterExtensions Class

System.Web.Http.Tracing Namespace