DiagnosticListener 類別

定義

提供抽象的 DiagnosticSource 類別實作,表示來源傳送其資訊 (事件) 的具名位置。Provides an implementation of the abstract DiagnosticSource class that represents a named place to which a source sends its information (events).

public ref class DiagnosticListener : System::Diagnostics::DiagnosticSource, IDisposable, IObservable<System::Collections::Generic::KeyValuePair<System::String ^, System::Object ^>>
public class DiagnosticListener : System.Diagnostics.DiagnosticSource, IDisposable, IObservable<System.Collections.Generic.KeyValuePair<string,object>>
type DiagnosticListener = class
    inherit DiagnosticSource
    interface IDisposable
    interface IObservable<KeyValuePair<string, obj>>
type DiagnosticListener = class
    inherit DiagnosticSource
    interface IObservable<KeyValuePair<string, obj>>
    interface IDisposable
Public Class DiagnosticListener
Inherits DiagnosticSource
Implements IDisposable, IObservable(Of KeyValuePair(Of String, Object))
繼承
DiagnosticListener
實作

備註

DiagnosticListener 是 NotificationSource,這表示傳回的結果可以用來記錄通知,但是它也有一個方法, Subscribe 因此通知可以任意轉寄。DiagnosticListener is a NotificationSource, which means the returned result can be used to log notifications, but it also has a Subscribe method so notifications can be forwarded arbitrarily. 因此,其工作是將生產者的事物轉送到所有接聽程式, (多個轉型) 。Thus, its job is to forward things from the producer to all the listeners (multi-casting). 一般而言,您不應該建立自己的 DiagnosticListener ,但使用預設值,讓通知盡可能公開。Generally, you should not be making your own DiagnosticListener but use the default, so that notifications are as public as possible.

如需和類別的詳細資訊 DiagnosticSource DiagnosticListener ,請參閱 DiagnosticSource 使用者手冊For more information on the DiagnosticSource and DiagnosticListener classes, see DiagnosticSource User's Guide.

建構函式

DiagnosticListener(String)

建立新的 DiagnosticListenerCreates a new DiagnosticListener.

屬性

AllListeners

取得此 DiagnosticListener 的接聽程式集合。Gets the collection of listeners for this DiagnosticListener.

Name

取得這個 DiagnosticListener 的名稱。Gets the name of this DiagnosticListener.

方法

Dispose()

處置 NotificationListeners。Disposes the NotificationListeners.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
IsEnabled()

判斷是否有任何已註冊的訂閱者。Determines whether there are any registered subscribers.

IsEnabled(String)

檢查是否啟用 DiagnosticListenerChecks whether the DiagnosticListener is enabled.

IsEnabled(String, Object, Object)

檢查要診斷事件的任何訂閱者是否有興趣接收此名稱的事件。Checks if any subscriber to the diagnostic events is interested in receiving events with this name. 訂閱者會使用 Subscribe 中提供的委派來指出其興趣。Subscribers indicate their interest using a delegate provided in Subscribe.

IsEnabled(String, Object, Object)

驗證是否啟用通知事件。Verifies it the notification event is enabled.

(繼承來源 DiagnosticSource)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
OnActivityExport(Activity, Object)

叫用所有訂閱者的 OnActivityExport 方法。Invokes the OnActivityExport method of all the subscribers.

OnActivityExport(Activity, Object)

將狀態從活動傳輸給一些會在處理序外部發生的範圍或作業 (例如傳出的 HTTP 要求)。Transfers state from an activity to some event or operation, such as an outgoing HTTP request, that will occur outside the process.

(繼承來源 DiagnosticSource)
OnActivityImport(Activity, Object)

叫用所有訂閱者的 OnActivityImport 方法。Invokes the OnActivityImport method of all the subscribers.

OnActivityImport(Activity, Object)

將狀態傳輸給一些會在處理序外部發生的範圍或作業活動,例如傳入的要求。Transfers state to an activity from some event or operation, such as an incoming request, that occurred outside the process.

(繼承來源 DiagnosticSource)
StartActivity(Activity, Object)

啟動 Activity 並寫入啟動事件。Starts an Activity and writes a start event.

(繼承來源 DiagnosticSource)
StopActivity(Activity, Object)

停止指定的 Activity,維護全域 Current 活動,然後通知取用者已停止 ActivityStops the given Activity, maintains the global Current activity, and notifies consumers that the Activity was stopped.

(繼承來源 DiagnosticSource)
Subscribe(IObserver<KeyValuePair<String,Object>>)

新增訂閱者。Adds a subscriber.

Subscribe(IObserver<KeyValuePair<String,Object>>, Func<String,Object,Object,Boolean>)

新增訂閱者,並選擇性地根據其名稱和最多兩個內容事件物件來篩選事件。Adds a subscriber, and optionally filters events based on their name and up to two context objects.

Subscribe(IObserver<KeyValuePair<String,Object>>, Func<String,Object,Object,Boolean>, Action<Activity,Object>, Action<Activity,Object>)

新增訂閱者,選擇地根據其名稱和最多兩個內容物件來篩選事件,並指定提供者從處理序外部匯入或匯出活動時要呼叫的方法。Adds a subscriber, optionally filters events based on their name and up to two context objects, and specifies methods to call when providers import or export activites from outside the process.

Subscribe(IObserver<KeyValuePair<String,Object>>, Predicate<String>)

新增訂閱者,並選擇性地根據其名稱來篩選事件。Adds a subscriber, and optionally filters events based on their name.

ToString()

傳回名稱為此 DiagnosticListener 的字串。Returns a string with the name of this DiagnosticListener.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)
Write(String, Object)

記錄通知。Logs a notification.

適用於