This package provides middleware for logging HTTP requests using Serilog in ASP.NET Core applications. It includes support for logging request bodies for POST, PUT, and PATCH methods, and query strings for all HTTP methods.
License
—
Deps
2
Install Size
—
Vulns
✓ 0
Published
Mar 21, 2025
$ dotnet add package Voyager.HttpRequestLoggerVoyager.HttpRequestLogger is a middleware for logging HTTP requests using Serilog in ASP.NET Core applications. It supports logging request bodies for POST, PUT, and PATCH methods, and query strings for all HTTP methods.
Install the package via NuGet:
dotnet add package Voyager.HttpRequestLogger
Program.cs:using Serilog;
using Serilog.Formatting.Compact;
Log.Logger = new LoggerConfiguration()
.WriteTo.Console(new CompactJsonFormatter())
.CreateLogger();
var builder = WebApplication.CreateBuilder(args);
builder.Host.UseSerilog();
Program.cs:var app = builder.Build();
app.UseVoyagerRequestLogging();
app.UseVoyagerRequestLogging((diagnosticContext, httpContext) =>
{
// Custom enrichment logic
});
This project is maintained by Andrzej Świstowski.
This project is licensed under the MIT License.