WebProcessInformation.FormatToString(WebEventFormatter) Metod

Definition

Formaterar programinformationen.

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)

Parametrar

formatter
WebEventFormatter

Som WebEventFormatter innehåller flik- och indragsinställningarna som används för att formatera information om webbhälsa.

Exempel

I följande exempel visas hur du formaterar anpassad information.

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

Kommentarer

Metoden FormatToString ger ett enhetligt format för händelseinformation, vilket är användbart om händelsedata måste loggas och senare visas för användaren. Metoden anropas internt när providern anropar någon av ToString metoderna.

Gäller för