WebProcessStatistics.FormatToString(WebEventFormatter) Metoda

Definicja

Formatuje statystyki procesu.

public:
 virtual void FormatToString(System::Web::Management::WebEventFormatter ^ formatter);
public virtual void FormatToString (System.Web.Management.WebEventFormatter formatter);
abstract member FormatToString : System.Web.Management.WebEventFormatter -> unit
override this.FormatToString : System.Web.Management.WebEventFormatter -> unit
Public Overridable 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)
{
    base.FormatCustomEventDetails(formatter);

    // Add custom data.

    formatter.AppendLine("");
    formatter.AppendLine(
        "Custom Process Statistics:");

    formatter.IndentationLevel += 1;

    // Get the process statistics.
    formatter.AppendLine(GetAppDomainCount());
    formatter.AppendLine(GetManagedHeapSize());
    formatter.AppendLine(GetPeakWorkingSet());
    formatter.AppendLine(GetProcessStartTime());
    formatter.AppendLine(GetRequestsExecuting());
    formatter.AppendLine(GetRequestsQueued());
    formatter.AppendLine(GetRequestsRejected());
    formatter.AppendLine(GetThreadCount());
    formatter.AppendLine(GetWorkingSet());

    formatter.IndentationLevel -= 1;

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

        ' Add custom data.
        formatter.AppendLine("")
        formatter.AppendLine("Custom Process Statistics:")

        formatter.IndentationLevel += 1

        ' Get the process statistics.
        formatter.AppendLine(GetAppDomainCount())
        formatter.AppendLine(GetManagedHeapSize())
        formatter.AppendLine(GetPeakWorkingSet())
        formatter.AppendLine(GetProcessStartTime())
        formatter.AppendLine(GetRequestsExecuting())
        formatter.AppendLine(GetRequestsQueued())
        formatter.AppendLine(GetRequestsRejected())
        formatter.AppendLine(GetThreadCount())
        formatter.AppendLine(GetWorkingSet())

        formatter.IndentationLevel -= 1

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

Uwagi

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

Dotyczy