Language

TracingBuilderExtensions.AddListener Method

Definition

Overloads

Name Description
AddListener(ITracingBuilder, String, Action<ActivityListenerBuilder>)

Registers a new ActivityListener identified by name and described by the supplied configure callback.

AddListener(ITracingBuilder, String, Action<IServiceProvider,ActivityListenerBuilder>)

Registers a new ActivityListener identified by name and described by the supplied configure callback, which also receives the resolved IServiceProvider.

AddListener(ITracingBuilder, String, Action<ActivityListenerBuilder>)

Source:
TracingBuilderExtensions.Listeners.cs
Source:
TracingBuilderExtensions.Listeners.cs

Registers a new ActivityListener identified by name and described by the supplied configure callback.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::Diagnostics::Tracing::ITracingBuilder ^ AddListener(Microsoft::Extensions::Diagnostics::Tracing::ITracingBuilder ^ builder, System::String ^ name, Action<Microsoft::Extensions::Diagnostics::Tracing::ActivityListenerBuilder ^> ^ configure);
public static Microsoft.Extensions.Diagnostics.Tracing.ITracingBuilder AddListener(this Microsoft.Extensions.Diagnostics.Tracing.ITracingBuilder builder, string name, Action<Microsoft.Extensions.Diagnostics.Tracing.ActivityListenerBuilder> configure);
static member AddListener : Microsoft.Extensions.Diagnostics.Tracing.ITracingBuilder * string * Action<Microsoft.Extensions.Diagnostics.Tracing.ActivityListenerBuilder> -> Microsoft.Extensions.Diagnostics.Tracing.ITracingBuilder
<Extension()>
Public Function AddListener (builder As ITracingBuilder, name As String, configure As Action(Of ActivityListenerBuilder)) As ITracingBuilder

Parameters

name
String

A name used by configuration-based filtering to identify this listener for rule matching.

configure
Action<ActivityListenerBuilder>

A callback that configures the delegate properties of the supplied ActivityListenerBuilder.

Returns

Returns the original ITracingBuilder for chaining.

Remarks

The tracing infrastructure invokes configure once when the underlying ActivitySourceFactory is first resolved, snapshots the delegate properties from the supplied ActivityListenerBuilder, and constructs the registered ActivityListener itself. Subscription to ActivitySource instances is driven entirely by the configuration-based TracingRule set; the builder re-evaluates listener subscriptions automatically when the bound TracingOptions change.

Applies to

AddListener(ITracingBuilder, String, Action<IServiceProvider,ActivityListenerBuilder>)

Source:
TracingBuilderExtensions.Listeners.cs
Source:
TracingBuilderExtensions.Listeners.cs

Registers a new ActivityListener identified by name and described by the supplied configure callback, which also receives the resolved IServiceProvider.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::Diagnostics::Tracing::ITracingBuilder ^ AddListener(Microsoft::Extensions::Diagnostics::Tracing::ITracingBuilder ^ builder, System::String ^ name, Action<IServiceProvider ^, Microsoft::Extensions::Diagnostics::Tracing::ActivityListenerBuilder ^> ^ configure);
public static Microsoft.Extensions.Diagnostics.Tracing.ITracingBuilder AddListener(this Microsoft.Extensions.Diagnostics.Tracing.ITracingBuilder builder, string name, Action<IServiceProvider,Microsoft.Extensions.Diagnostics.Tracing.ActivityListenerBuilder> configure);
static member AddListener : Microsoft.Extensions.Diagnostics.Tracing.ITracingBuilder * string * Action<IServiceProvider, Microsoft.Extensions.Diagnostics.Tracing.ActivityListenerBuilder> -> Microsoft.Extensions.Diagnostics.Tracing.ITracingBuilder
<Extension()>
Public Function AddListener (builder As ITracingBuilder, name As String, configure As Action(Of IServiceProvider, ActivityListenerBuilder)) As ITracingBuilder

Parameters

name
String

A name used by configuration-based filtering to identify this listener for rule matching.

configure
Action<IServiceProvider,ActivityListenerBuilder>

A callback that configures the supplied ActivityListenerBuilder, with access to the resolved IServiceProvider.

Returns

Returns the original ITracingBuilder for chaining.

Remarks

The tracing infrastructure invokes configure once when the underlying ActivitySourceFactory is first resolved, snapshots the delegate properties from the supplied ActivityListenerBuilder, and constructs the registered ActivityListener itself. Subscription to ActivitySource instances is driven entirely by the configuration-based TracingRule set; the builder re-evaluates listener subscriptions automatically when the bound TracingOptions change.

Applies to