I\'ve configured my console application\'s Main like so
var services = new ServiceCollection()
.AddLogging(logging => logging.Add
In .NET Core, ILogger is automatically registered for you. As ILogger inherits from ILogger, you can request an instance of ILogger from the IServiceProvider.
For example:
services.AddSingleton
Note that this will return an ILogger wherever you've got a non-generic ILogger constructor parameter so if you need more than one, look into creating it specifically for that instance by using the AddSingleton (or transient/or scoped) implementationFactory override.