Прочетете на английски

Споделяне чрез


LoggingServiceCollectionExtensions.AddLogging Method

Definition

Overloads

AddLogging(IServiceCollection)

Adds logging services to the specified IServiceCollection.

AddLogging(IServiceCollection, Action<ILoggingBuilder>)

Adds logging services to the specified IServiceCollection.

AddLogging(IServiceCollection)

Source:
LoggingServiceCollectionExtensions.cs
Source:
LoggingServiceCollectionExtensions.cs
Source:
LoggingServiceCollectionExtensions.cs

Adds logging services to the specified IServiceCollection.

C#
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddLogging(this Microsoft.Extensions.DependencyInjection.IServiceCollection services);

Parameters

services
IServiceCollection

The IServiceCollection to add services to.

Returns

The IServiceCollection so that additional calls can be chained.

Applies to

.NET 10 (package-provided) и други версии
Продукт Версии
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)

AddLogging(IServiceCollection, Action<ILoggingBuilder>)

Source:
LoggingServiceCollectionExtensions.cs
Source:
LoggingServiceCollectionExtensions.cs
Source:
LoggingServiceCollectionExtensions.cs

Adds logging services to the specified IServiceCollection.

C#
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddLogging(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<Microsoft.Extensions.Logging.ILoggingBuilder> configure);

Parameters

services
IServiceCollection

The IServiceCollection to add services to.

configure
Action<ILoggingBuilder>

The ILoggingBuilder configuration delegate.

Returns

The IServiceCollection so that additional calls can be chained.

Applies to

.NET 10 (package-provided) и други версии
Продукт Версии
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)