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 - ASP.NET Core Tutorial
From the course: ASP.NET Core Health Checks
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
(Locked)
Understanding ILogger1m 28s
-
(Locked)
What's in the template?4m 49s
-
Adding log entries7m 39s
-
(Locked)
Understanding log levels4m 32s
-
(Locked)
Configuring logging5m 17s
-
(Locked)
Logging to files6m 20s
-
(Locked)
Logging to Azure6m 1s
-
(Locked)
Using log scopes4m 44s
-
(Locked)
Challenge: Add logging to the sample app1m 55s
-
(Locked)
Solution: Add logging to the sample app3m 21s
-
(Locked)
Summary of ASP.NET logging1m
-
(Locked)
-