WebThreadInformation.FormatToString(WebEventFormatter) Méthode

Définition

Met en forme les informations relatives aux threads.

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)

Paramètres

formatter
WebEventFormatter

Qui WebEventFormatter contient les paramètres d’onglet et de mise en retrait utilisés pour mettre en forme les informations d’événement d’intégrité web.

Exemples

L’exemple de code suivant montre comment mettre en forme des informations personnalisées.


// 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

Remarques

La FormatToString méthode fournit un format uniforme pour les informations d’événement, ce qui est utile si les données d’événement doivent être journalisées et présentées ultérieurement à l’utilisateur. Elle est appelée en interne lorsque le fournisseur appelle l’une des ToString méthodes.

S’applique à