EnrichmentServiceCollectionExtensions.AddLogEnricher Method

Definition

Overloads

AddLogEnricher(IServiceCollection, ILogEnricher)

Registers a log enricher instance.

AddLogEnricher<T>(IServiceCollection)

Registers a log enricher type.

AddLogEnricher(IServiceCollection, ILogEnricher)

Source:
EnrichmentServiceCollectionExtensions.cs

Registers a log enricher instance.

C#
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddLogEnricher(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Microsoft.Extensions.Diagnostics.Enrichment.ILogEnricher enricher);

Parameters

services
IServiceCollection

The dependency injection container to add the enricher instance to.

enricher
ILogEnricher

The enricher instance to add.

Returns

The value of services.

Exceptions

services or enricher is null.

Applies to

.NET 10 (package-provided) и друге верзије
Производ Верзије
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)

AddLogEnricher<T>(IServiceCollection)

Source:
EnrichmentServiceCollectionExtensions.cs

Registers a log enricher type.

C#
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddLogEnricher<T>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services) where T : class, Microsoft.Extensions.Diagnostics.Enrichment.ILogEnricher;

Type Parameters

T

Enricher type.

Parameters

services
IServiceCollection

The dependency injection container to add the enricher type to.

Returns

The value of services.

Exceptions

services is null.

Applies to

.NET 10 (package-provided) и друге верзије
Производ Верзије
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)