In this code example for creating a logging instance using Dependency Injection in ASP.NET Core why is the logger type the controller class when injecting the logger in the constructor?
ILogger<TodoController> logger
Instead of ILogger<TodoController> shouldn't it be just ILogger logger passed into the constructor?
Code example:
public class TodoController : Controller
{
private readonly ITodoRepository _todoRepository;
private readonly ILogger _logger;
public TodoController(ITodoRepository todoRepository,
ILogger<TodoController> logger)
{
_todoRepository = todoRepository;
_logger = logger;
}
Startup.csto configure the dependency injection. Your code sample only shows the portion of the code where you are retrieving the objects governed by dependency injection. - Glenn Ferrie