You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, we can't write logs in ConfigureServices since the dependency injection phase has not been completed and the ILogger can be resolved once dependency injection completed.
We are introducing IInitLogger that can be used in DI registration phase, in ConfigureServices.
When you have IServiceCollection services, you can use services.GetInitLogger() to obtain a reference to the IInitLogger. Then you can write logs like;
varlogger= services.GetInitLogger();
logger.Log(LogLevel.Information,"my log message...");//gets optional `Exception` as the last argument.
Logs are collected in a collection and written to the actual ILogger once the DI registration phase completes and we are able to resolve the ILogger.
The text was updated successfully, but these errors were encountered:
Currently, we can't write logs in
ConfigureServices
since the dependency injection phase has not been completed and theILogger
can be resolved once dependency injection completed.We are introducing
IInitLogger
that can be used in DI registration phase, inConfigureServices
.When you have
IServiceCollection services
, you can useservices.GetInitLogger()
to obtain a reference to theIInitLogger
. Then you can write logs like;Logs are collected in a collection and written to the actual
ILogger
once the DI registration phase completes and we are able to resolve theILogger
.The text was updated successfully, but these errors were encountered: