CarterCommunity / Carter

Carter is framework that is a thin layer of extension methods and functionality over ASP.NET Core allowing code to be more explicit and most importantly more enjoyable.
MIT License
2.06k stars 174 forks source link

Change module scoped logger #251

Closed gkinsman closed 3 years ago

gkinsman commented 4 years ago

This PR changes the logger used in the request lambda in CarterExtensions to use a category of Carter instead of the full name of the module type. The module type name is then added as a scope in the request handler.

This makes it possible to filter out the Executing module route handler for message filtering out Carter category instead of having to do it on each module type. It should generally be possible to filter out carter logs with the Carter category I think.

I've addded MartinCostello.Logging.XUnit which connects XUnit's ITestOutputHelper with ANC logging so the logs will show up in the test output, so it's easy to see what is being output. Currently only added it to the CarterModuleTests, not sure if we want/need this behaviour elsewhere. I think its useful.