Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Diagnostics.​DiagnosticSource

Assembly: System.Diagnostics.DiagnosticSource

Inheritance: object → DiagnosticSource

An abstract class that allows code to be instrumented for production-time logging of rich data payloads for consumption within the process that was instrumented.

Methods

public bool
IsEnabled​(string name)
Verifies if the notification event is enabled.
Returns <see langword="true" /> if the notification event is enabled, <see langword="false" /> otherwise.
name The name of the event being written.
public bool
IsEnabled​(string name, object arg1, object arg2 = null)
Verifies it the notification event is enabled.
Returns <see langword="true" /> if the notification event is enabled, <see langword="false" /> otherwise.
name The name of the event being written.
arg1 An object that represents the additional context for IsEnabled. Consumers should expect to receive <see langword="null" /> , which might indicate that producer called pure IsEnabled(string) to check if consumer wants to get notifications for such events at all. Based on that, producer may call IsEnabled(string, object, object) again with non- <see langword="null" /> context.
arg2 Optional. An object that represents the additional context for IsEnabled. <see langword="null" /> by default. Consumers should expect to receive <see langword="null" /> , which might indicate that producer called pure IsEnabled(string) or producer passed all necessary context in <paramref name="arg1" /> .
public void
Write​(string name, object value)
Provides a generic way of logging complex payloads.
name The name of the event being written.
value An object that represents the value being passed as a payload for the event. This is often an anonymous type that contains several subvalues.
public void
Write​(string name, T value)
Provides a generic way of logging complex payloads.
name The name of the event being written.
value An object that represents the value being passed as a payload for the event. This is often an anonymous type that contains several subvalues.
public void
OnActivityExport​(Activity activity, object payload)
Transfers state from an activity to some event or operation, such as an outgoing HTTP request, that will occur outside the process.
activity The activity affected by an external event.
payload An object that represents the outgoing request.
public void
OnActivityImport​(Activity activity, object payload)
Transfers state to an activity from some event or operation, such as an incoming request, that occurred outside the process.
activity The activity affected by an external event.
payload A payload that represents the incoming request.
public Activity
StartActivity​(Activity activity, object args)
Starts an <see cref="T:System.Diagnostics.Activity" /> and writes a start event.
Returns The started activity for convenient chaining.
activity The <see cref="T:System.Diagnostics.Activity" /> to be started.
args An object that represent the value being passed as a payload for the event.
public Activity
StartActivity​(Activity activity, T args)
Starts an <xref data-throw-if-not-resolved="true" uid="System.Diagnostics.Activity"></xref> and writes a start event.
Returns The started activity for convenient chaining.
activity The <xref data-throw-if-not-resolved="true" uid="System.Diagnostics.Activity"></xref> to be started.
args An object that represent the value being passed as a payload for the event.
public void
StopActivity​(Activity activity, object args)
Stops the given <see cref="T:System.Diagnostics.Activity" /> , maintains the global <see cref="P:System.Diagnostics.Activity.Current" /> activity, and notifies consumers that the <see cref="T:System.Diagnostics.Activity" /> was stopped.
activity The activity to be stopped.
args An object that represents the value passed as a payload for the event.
public void
StopActivity​(Activity activity, T args)
Starts an <xref data-throw-if-not-resolved="true" uid="System.Diagnostics.Activity"></xref> and writes a start event.
Returns The started activity for convenient chaining.
activity The <xref data-throw-if-not-resolved="true" uid="System.Diagnostics.Activity"></xref> to be started.
args An object that represent the value being passed as a payload for the event.
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object