From the course: ASP.NET Core Health Checks

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Understanding ILogger

Understanding ILogger

- [Instructor] Let's talk about ASP.NET Core logging. So we will create a log with log entries. We see different ways of doing that, and then talk about different storage options for those logs. And a few extra features. Most of them are based on one specific interface, the ILogger interface. And that interface is relatively small, it consists of three things. First of all, it contains a method called BeginScope that can be used to logically group certain log entries. We'll see that in a bit. Then, there's a property called IsEnabled, and I think you have a hunch what that means. And finally, there is one method that's the part of the logger you'll interact with the most. The method is called Log. It expects a lot of different properties. But yeah, that's it. We have an interface, and if we are working with a custom logger, we just implement that interface. And most of the action will take place in that Log method because when we are working with a logger, we call Log to, well, create…

Contents