<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="10.0.0-preview.2.25163.2" />

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, 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.

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.