WebApplicationInformation.FormatToString(WebEventFormatter) 메서드

정의

애플리케이션 정보의 형식을 지정합니다.

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)

매개 변수

formatter
WebEventFormatter

WebEventFormatter 웹 상태 이벤트 정보의 서식을 지정하는 데 사용되는 탭 및 들여쓰기 설정이 들어 있는 항목입니다.

예제

다음 코드 예제에서는 사용자 지정 정보의 서식을 지정하는 방법을 보여줍니다.

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

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

    // Display the application information.
    formatter.AppendLine(GetApplicationDomain());
    formatter.AppendLine(GetApplicationPath());
    formatter.AppendLine(GetApplicationVirtualPath());
    formatter.AppendLine(GetApplicationMachineName());
    formatter.AppendLine(GetApplicationTrustLevel());
    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( _
        "Custom Application Information:")
        formatter.IndentationLevel += 1

        ' Display the application information.
        formatter.AppendLine(GetApplicationDomain())
        formatter.AppendLine(GetApplicationPath())
        formatter.AppendLine(GetApplicationVirtualPath())
        formatter.AppendLine(GetApplicationMachineName())
        formatter.AppendLine(GetApplicationTrustLevel())
        formatter.IndentationLevel -= 1
        formatter.AppendLine(eventInfo.ToString())
    End Sub
End Class

설명

이 메서드는 FormatToString 이벤트 정보에 대한 균일한 형식을 제공합니다. 이 형식은 이벤트 데이터를 기록해야 하고 나중에 사용자에게 제공해야 하는 경우에 유용합니다. 공급자가 메서드 중 ToString 하나를 호출할 때 내부적으로 호출됩니다.

메모

표시할 사용자 지정 이벤트 정보의 서식을 지정할 때 메서드 대신 메서드를 재정의 FormatToStringToString 합니다. 이렇게 하면 중요한 시스템 정보를 덮어쓰거나 변조하지 않습니다.

적용 대상