Context: Simple out-of-the-box blazor 3.1 SERVER SIDE example - adding logging (just trying to get stuff to the debug conolse in VS2019 in components).
I leave ConfigureServices as is, and have found SO examples that logging is setup in program.cs(!) This works:
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureLogging(
logging =>
{
logging.ClearProviders();
logging.AddConsole();
})
ect.
In my components, everything is resolved fine with
[Inject] public ILogger<Foo> Logger { get; set; }
But why not in ConfigureServices, where rest of stuff, that should be DI'ed, is setup ???
- Is there a "under the hood" DI going on? (a little like what was going on in .Net frameework w/ webapi)?
- Can it be moved to ConfigureServices with excact same result (or at all )?