Automatic audit logs in .NET
A common requirement for most serious applications is to be able to produce audit logs: information about which user has accessed what information and when.
In the .NET Core 5.0 API we are building right now, we decided to implement this functionality as a middleware that will automatically be executed upon every request to the API.
We want to log the response actually sent back to the client, so it’s important that we put our new middleware first (or at least very early) in the HTTP request pipeline.