Using uBeac.Web.Logging you can log and store HTTP request/response.
Install the package with NuGet:
dotnet add package uBeac.Web.Logging
Just put the following code in Program.cs:
app.UseHttpLoggingMiddleware();You must implement IHttpLoggingRepository to store logs:
public class HttpLoggingRepository : IHttpLoggingRepository
{
}And register it in dependency container:
builder.Services.AddScoped<IHttpLoggingRepository, HttpLoggingRepository>();Or you can use the following packages:
- uBeac.Web.Logging.MongoDB: For storing in MongoDB