編集

次の方法で共有


WebEventFormatter Class

Definition

Formats ASP.NET health monitoring event information.

public ref class WebEventFormatter
public class WebEventFormatter
type WebEventFormatter = class
Public Class WebEventFormatter
Inheritance
WebEventFormatter

Examples

The following code example shows how to use the WebEventFormatter to format event information. It is mainly intended to show the correct syntax to use. This code example is part of a larger example provided for the WebBaseEvent class.

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

    // Add custom data.
    formatter.AppendLine("");

    formatter.IndentationLevel += 1;

    formatter.TabSize = 4;

    formatter.AppendLine(
         "*SampleWebBaseEvent Start *");

    // Display custom event information.
    formatter.AppendLine(customCreatedMsg);
    formatter.AppendLine(customRaisedMsg);
    formatter.AppendLine(firingRecordInfo);

    formatter.AppendLine(
  "* SampleWebBaseEvent End *");


    formatter.IndentationLevel -= 1;
}
    'Formats Web request event information.
    Public Overrides Sub FormatCustomEventDetails( _
ByVal formatter As WebEventFormatter)
        MyBase.FormatCustomEventDetails(formatter)

        ' Add custom data.
        formatter.AppendLine("")

        formatter.IndentationLevel += 1
        
        formatter.TabSize = 4
        
        formatter.AppendLine("*SampleWebBaseEvent Start *")
        formatter.AppendLine("Custom information goes here")
        formatter.AppendLine("* SampleWebBaseEvent End *")
        ' Display custom event timing.
        formatter.AppendLine(customCreatedMsg)
        formatter.AppendLine(customRaisedMsg)
        formatter.IndentationLevel -= 1

    End Sub

Remarks

ASP.NET health monitoring allows production and operations staff to manage deployed Web applications. The System.Web.Management namespace contains the health-event types responsible for packaging application health-status data and the provider types responsible for processing this data. It also contains supporting types that help during the management of health events.

The WebEventFormatter is a supporting type used to uniformly format event-related information, which is useful if the event data must be logged and later presented to the user.

Instances of the WebEventFormatter class are passed as arguments to the formatting methods defined by the health-event types.

Properties

IndentationLevel

Gets or sets the indentation level.

TabSize

Gets or sets the tab size.

Methods

AppendLine(String)

Appends the specified string and a carriage return to the event information.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns the event information in string format.

Applies to