다음을 통해 공유


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 메서드.

참고

표시를 위해 사용자 지정 이벤트 정보를 포맷할 때 재정의 된 FormatToString 메서드 대신 ToString 메서드. 이 중요 한 시스템 정보를 덮어쓰거나 훼손 하지 것입니다.

적용 대상