Movatterモバイル変換


[0]ホーム

URL:


Skip to main contentSkip to in-page navigation

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

DiagnosticListener Class

Definition

Namespace:
System.Diagnostics
Assembly:
System.Diagnostics.DiagnosticSource.dll
Package:
System.Diagnostics.DiagnosticSource v10.0.0
Source:
DiagnosticListener.cs
Source:
DiagnosticListener.cs
Source:
DiagnosticListener.cs
Source:
DiagnosticListener.cs
Source:
DiagnosticListener.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Provides an implementation of the abstractDiagnosticSource 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 DiagnosticListenerInherits DiagnosticSourceImplements IDisposable, IObservable(Of KeyValuePair(Of String, Object))
Inheritance
DiagnosticListener
Implements

Remarks

DiagnosticListener is a NotificationSource, which means the returned result can be used to log notifications, but it also has aSubscribe method so notifications can be forwarded arbitrarily. Thus, its job is to forward things from the producer to all the listeners (multi-casting). Generally, you should not be making your ownDiagnosticListener but use the default, so that notifications are as public as possible.

For more information on theDiagnosticSource andDiagnosticListener classes, seeDiagnosticSource User's Guide.

Constructors

NameDescription
DiagnosticListener(String)

Creates a newDiagnosticListener.

Properties

NameDescription
AllListeners

Gets the collection of listeners for thisDiagnosticListener.

Name

Gets the name of thisDiagnosticListener.

Methods

NameDescription
Dispose()

Disposes the NotificationListeners.

Equals(Object)

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

(Inherited fromObject)
GetHashCode()

Serves as the default hash function.

(Inherited fromObject)
GetType()

Gets theType of the current instance.

(Inherited fromObject)
IsEnabled()

Determines whether there are any registered subscribers.

IsEnabled(String, Object, Object)

Checks if any subscriber to the diagnostic events is interested in receiving events with this name. Subscribers indicate their interest using a delegate provided inSubscribe.

IsEnabled(String)

Checks whether theDiagnosticListener is enabled.

MemberwiseClone()

Creates a shallow copy of the currentObject.

(Inherited fromObject)
OnActivityExport(Activity, Object)

Invokes the OnActivityExport method of all the subscribers.

OnActivityImport(Activity, Object)

Invokes the OnActivityImport method of all the subscribers.

StartActivity(Activity, Object)

Starts anActivity and writes a start event.

(Inherited fromDiagnosticSource)
StartActivity<T>(Activity, T)

Starts anActivity and writes a start event.

(Inherited fromDiagnosticSource)
StopActivity(Activity, Object)

Stops the givenActivity, maintains the globalCurrent activity, and notifies consumers that theActivity was stopped.

(Inherited fromDiagnosticSource)
StopActivity<T>(Activity, T)

Starts anActivity and writes a start event.

(Inherited fromDiagnosticSource)
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>>, 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>>, Predicate<String>)

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

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

Adds a subscriber.

ToString()

Returns a string with the name of this DiagnosticListener.

ToString()

Returns a string that represents the current object.

(Inherited fromObject)
Write(String, Object)

Logs a notification.

Write<T>(String, T)

Provides a generic way of logging complex payloads.

(Inherited fromDiagnosticSource)

Extension Methods

NameDescription
SubscribeWithAdapter(DiagnosticListener, Object, Func<String,Boolean>)
SubscribeWithAdapter(DiagnosticListener, Object, Func<String,Object,Object,Boolean>)
SubscribeWithAdapter(DiagnosticListener, Object)

Applies to

Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, seeour contributor guide.

Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?