I've just started learning Ninject but have come across a problem with the logger. I've currently got a controller that has a service and logger injected into the constructor like so:
public ToolsController(IToolsService toolsService, ILogger logger)
{
logger.Info("ToolsController Created");
this.toolsService = toolsService;
this.logger = logger;
}
The problem is on the logger.Info line (for example) in the constructor which seems to use the wrong logger, so the logger name it prints out is incorrect.
Tools.IGeocodeImporter: ToolsController Created
Below is how it is setup to get the logger name:
kernel.Bind<ILogger>().To<Logger>().WithConstructorArgument("name", x => x.Request.ParentContext.Request.Service.FullName);
Any advice would be appreciated.
ToolsController: ToolsController Created
– Scaler