<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="5.0.0-preview.8.20407.11" />

DiagnosticListener

Provides an implementation of the abstract DiagnosticSource class that represents a named place to which a source sends its information (events).

Gets the collection of listeners for this DiagnosticListener.

public string Name { get; }

Gets the name of this DiagnosticListener.

public DiagnosticListener(string name)

Creates a new DiagnosticListener.

public virtual void Dispose()

Disposes the NotificationListeners.

public bool IsEnabled()

Determines whether there are any registered subscribers.

public virtual IDisposable Subscribe(IObserver<KeyValuePair<string, object>> observer, Predicate<string> isEnabled)

Adds a subscriber, and optionally filters events based on their name.

public virtual IDisposable Subscribe(IObserver<KeyValuePair<string, object>> observer, Func<string, object, object, bool> isEnabled)

Adds a subscriber, and optionally filters events based on their name and up to two context objects.

public virtual IDisposable Subscribe(IObserver<KeyValuePair<string, object>> observer)

Adds a subscriber.

public virtual IDisposable Subscribe(IObserver<KeyValuePair<string, object>> observer, Func<string, object, object, bool> isEnabled, Action<Activity, object> onActivityImport = null, Action<Activity, object> onActivityExport = null)

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.