WebEventProvider.Flush 메서드

정의

공급자의 버퍼에서 이벤트 로그로 이벤트를 이동합니다.

public:
 abstract void Flush();
public abstract void Flush();
abstract member Flush : unit -> unit
Public MustOverride Sub Flush ()

예제

다음 코드 예제에서는 메서드를 사용 하는 방법을 보여 있습니다 Flush .

// Flush the input buffer if required.
public override void Flush()
{
    // Create a string builder to 
    // hold the event information.
    StringBuilder reData = new StringBuilder();

    // Store custom information.
    reData.Append("SampleEventProvider processing." +
        Environment.NewLine);
    reData.Append("Flush done at: {0}" +
        DateTime.Now.TimeOfDay.ToString() +
        Environment.NewLine);
    
    foreach (WebBaseEvent e in msgBuffer)
    {
        // Store event data.
        reData.Append(e.ToString());
    }

    // Store the information in the specified file.
    StoreToFile(reData, logFilePath, FileMode.Append);

    // Reset the message counter.
    msgCounter = 0;
    
    // Clear the buffer.
    msgBuffer.Clear();
}
' Flush the input buffer if required.
Public Overrides Sub Flush() 
    ' Create a string builder to 
    ' hold the event information.
    Dim reData As New StringBuilder()
    
    ' Store custom information.
    reData.Append( _
    "SampleEventProvider processing." + _
    Environment.NewLine)

    reData.Append( _
    "Flush done at: {0}" + _
    DateTime.Now.TimeOfDay.ToString() + _
    Environment.NewLine)
    
    Dim e As WebBaseEvent
    For Each e In  msgBuffer
        ' Store event data.
        reData.Append(e.ToString())
    Next e
    
    ' Store the information in the specified file.
    StoreToFile(reData, logFilePath, FileMode.Append)
    
    ' Reset the message counter.
    msgCounter = 0
    
    ' Clear the buffer.
    msgBuffer.Clear()

End Sub

설명

이 메서드가 호출되면 마지막 쓰기 이후 경과된 시간 또는 버퍼에 있는 이벤트 수에 관계없이 버퍼의 모든 이벤트가 버퍼에서 이벤트 로그로 즉시 이동됩니다. 마지막 쓰기 시간이 플러시 작업의 시간으로 다시 설정됩니다.

적용 대상