SimpleInjectorServiceCollectionExtensionsAddLogging Method

Simple Injector
Allows components that are built by Simple Injector to depend on the (non-generic) Microsoft.Extensions.Logging.ILogger abstraction. Components are injected with an contextual implementation. Using this method, application components can simply depend on ILogger instead of its generic counter part, ILogger<T>, which simplifies development.

Namespace:  SimpleInjector
Assembly:  SimpleInjector.Integration.ServiceCollection (in SimpleInjector.Integration.ServiceCollection.dll) Version: 5.0.0

public static SimpleInjectorAddOptions AddLogging(
	this SimpleInjectorAddOptions options


Type: SimpleInjector.Integration.ServiceCollectionSimpleInjectorAddOptions
The options.

Return Value

Type: SimpleInjectorAddOptions
The supplied options.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type SimpleInjectorAddOptions. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

ArgumentNullException Thrown when options is a null reference.
InvalidOperationExceptionThrown when no ILoggerFactory entry can be found in the framework's list of services defined by IServiceCollection.
See Also