Reputation: 225
I want to know the advantages to use ILogger as logging tool for .net framework and .net core under Microsoft.Extensions.Logging;
Thanks in advance.
Upvotes: 0
Views: 367
Reputation: 239220
Microsoft.Extensions.Logging
merely provides a logging facade. There's other libraries that do the same thing, such as Common.Logging
, and to a certain extent Serilog.
The facade pattern is a way of abstracting away an particular implementation of functionality. Here, all your code really cares about it logging. Whether those logs go to the console, a database, Application Insights, etc. is totally inconsequential.
That is what Ilogger
provides you. It's a consistent interface for generically logging. You can then decide to use whatever actual logging provider you want later or switch between them at a whim, without effecting any of your application code.
Upvotes: 1