Aracılığıyla paylaş


WebProcessInformation.FormatToString(WebEventFormatter) Yöntem

Tanım

Uygulama bilgilerini biçimlendirin.

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)

Parametreler

formatter
WebEventFormatter

WebEventFormatter Web sistem durumu olay bilgilerini biçimlendirmek için kullanılan sekme ve girinti ayarlarını içeren.

Örnekler

Aşağıdaki örnekte özel bilgilerin nasıl biçimlendirilir gösterilmektedir.

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

Açıklamalar

yöntemi, FormatToString olay bilgileri için tekdüzen bir biçim sağlar. Bu biçim, olay verilerinin günlüğe kaydedilmesi ve daha sonra kullanıcıya sunulması gerekiyorsa yararlıdır. Sağlayıcı yöntemlerden birini ToString çağırdığında yöntemi dahili olarak çağrılır.

Şunlara uygulanır