I have ASP.NET Core application with React client. I have SignalR messaging between server and client.
I have the following code on server side:
Startup.cs
...
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseSignalR(routes =>
{
routes.MapHub<ChatHub>("/signalr");
});
}
...
Question: Could I pass logger to ChatHub from Startup.cs as I do it with another services like this:
Startup.cs
private readonly ILogger _log;
public Startup(IHostingEnvironment env, ILogger<Startup> log)
{
_log = log;
}
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton(new Converter(_log));
}