Partage via


WebProcessInformation.FormatToString(WebEventFormatter) Méthode

Définition

Met en forme les informations d'application.

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

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

Exemples

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

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

    // Add custom data.
    formatter.AppendLine("Custom Process Information:");
    formatter.IndentationLevel += 1;

    // Display the process information.
    formatter.AppendLine(GetAccountName());
    formatter.AppendLine(GetProcessId());
    formatter.AppendLine(GetProcessName());
    formatter.IndentationLevel -= 1;
    formatter.AppendLine(eventInfo.ToString());
}
 'Formats Web request event information.
 Public Overrides Sub FormatCustomEventDetails( _
 ByVal formatter _
 As System.Web.Management.WebEventFormatter)
     MyBase.FormatCustomEventDetails(formatter)

     ' Add custom data.
     formatter.AppendLine("")
     formatter.AppendLine( _
     "Custom Process Information:")
     formatter.IndentationLevel += 1

     ' Display the process information.
     formatter.AppendLine(GetAccountName())
     formatter.AppendLine(GetProcessId())
     formatter.AppendLine(GetProcessName())
     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. La méthode est appelée en interne lorsque le fournisseur appelle l’une des ToString méthodes.

S’applique à