How to register ILogger for injection in ASP.NET MVC 6

前端 未结 3 2065
你的背包
你的背包 2021-02-06 20:55

I have a ASP.NET MVC 6 (beta-4) app.

public void ConfigureServices(IServiceCollection services)
{
    // Logging
    services.AddLogging();

    // ...
}

publi         


        
3条回答
  •  心在旅途
    2021-02-06 21:53

    just add this line to ConfigureServices

    services.AddSingleton(Serilog.Log.Logger);
    

提交回复
热议问题