addConfiguration method
Adds services required to consume ILoggerProviderConfigurationFactory.
This method registers the configuration factory that allows logger providers to retrieve their specific configuration from the application's configuration system.
Example:
services.addLogging((logging) {
logging.addConfiguration(hostContext.configuration);
});
After calling this method, logger providers can inject ILoggerProviderConfigurationFactory to access their configuration.
Implementation
LoggingBuilder addConfiguration(IConfiguration configuration) {
// Register the configuration factory as a singleton
services.tryAddSingleton<ILoggerProviderConfigurationFactory>(
(sp) => LoggerProviderConfigurationFactoryImpl([configuration]),
);
return this;
}