次の方法で共有


WebThreadInformation.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

Web の状態イベント情報の書式設定に使用するタブとインデントの設定を格納している WebEventFormatter

次のコード例は、カスタム情報の書式を設定する方法を示しています。


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

    // Add custom data.

    formatter.AppendLine("");
    formatter.AppendLine(
        "Custom Thread Information:");

    formatter.IndentationLevel += 1;

    // Display the thread information obtained 
    formatter.AppendLine(GetThreadImpersonation());
    formatter.AppendLine(GetThreadStackTrace());
    formatter.AppendLine(GetThreadAccountName());
    formatter.AppendLine(GetThreadId());
    formatter.IndentationLevel -= 1;

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

     ' Add custom data.
     formatter.AppendLine("")
     formatter.AppendLine( _
     "Custom Thread Information:")

     formatter.IndentationLevel += 1

     ' Display the thread information obtained 
     formatter.AppendLine(GetThreadImpersonation())
     formatter.AppendLine(GetThreadStackTrace())
     formatter.AppendLine(GetThreadAccountName())
     formatter.AppendLine(GetThreadId())
     formatter.IndentationLevel -= 1

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

注釈

このメソッドは FormatToString 、イベント情報の統一された形式を提供します。これは、イベント データをログに記録し、後でユーザーに提示する必要がある場合に便利です。 プロバイダーがいずれかのメソッドを呼び出すと、内部的に ToString 呼び出されます。

適用対象