Udostępnij za pośrednictwem


WebThreadInformation.FormatToString(WebEventFormatter) Metoda

Definicja

Formatuje informacje dotyczące wątków.

public:
 void FormatToString(System::Web::Management::WebEventFormatter ^ formatter);
public void FormatToString (System.Web.Management.WebEventFormatter formatter);
member this.FormatToString : System.Web.Management.WebEventFormatter -> unit
Public Sub FormatToString (formatter As WebEventFormatter)

Parametry

formatter
WebEventFormatter

Element WebEventFormatter zawierający ustawienia tabulatora i wcięcia używane do formatowania informacji o zdarzeniu kondycji sieci Web.

Przykłady

Poniższy przykład kodu przedstawia sposób formatowania informacji niestandardowych.


// Formats Web request event information.
public override void FormatCustomEventDetails(
 WebEventFormatter formatter)
{

    // Add custom data.

    formatter.AppendLine("");
    formatter.AppendLine(
        "Custom Thread Information:");

    formatter.IndentationLevel += 1;

    // Display the thread information obtained 
    formatter.AppendLine(GetThreadImpersonation());
    formatter.AppendLine(GetThreadStackTrace());
    formatter.AppendLine(GetThreadAccountName());
    formatter.AppendLine(GetThreadId());
    formatter.IndentationLevel -= 1;

    formatter.AppendLine(eventInfo.ToString());
}
' Formats Web request event information.
 Public Overrides Sub FormatCustomEventDetails( _
 ByVal formatter As WebEventFormatter)

     ' Add custom data.
     formatter.AppendLine("")
     formatter.AppendLine( _
     "Custom Thread Information:")

     formatter.IndentationLevel += 1

     ' Display the thread information obtained 
     formatter.AppendLine(GetThreadImpersonation())
     formatter.AppendLine(GetThreadStackTrace())
     formatter.AppendLine(GetThreadAccountName())
     formatter.AppendLine(GetThreadId())
     formatter.IndentationLevel -= 1

     formatter.AppendLine(eventInfo.ToString())
 End Sub

Uwagi

Metoda FormatToString udostępnia jednolity format informacji o zdarzeniach, co jest przydatne, jeśli dane zdarzenia muszą być rejestrowane, a później prezentowane użytkownikowi. Jest wywoływana wewnętrznie, gdy dostawca wywołuje jedną z ToString metod.

Dotyczy