Quilt4Net.Toolkit.Api
0.7.12
dotnet add package Quilt4Net.Toolkit.Api --version 0.7.12
NuGet\Install-Package Quilt4Net.Toolkit.Api -Version 0.7.12
<PackageReference Include="Quilt4Net.Toolkit.Api" Version="0.7.12" />
<PackageVersion Include="Quilt4Net.Toolkit.Api" Version="0.7.12" />
<PackageReference Include="Quilt4Net.Toolkit.Api" />
paket add Quilt4Net.Toolkit.Api --version 0.7.12
#r "nuget: Quilt4Net.Toolkit.Api, 0.7.12"
#:package Quilt4Net.Toolkit.Api@0.7.12
#addin nuget:?package=Quilt4Net.Toolkit.Api&version=0.7.12
#tool nuget:?package=Quilt4Net.Toolkit.Api&version=0.7.12
Quilt4Net.Toolkit.Api
HTTP request/response logging and correlation tracking middleware for .NET Web Applications.
Captures method, path, headers, query parameters, request/response bodies, client IP, and execution time. Logs to Application Insights and/or standard ILogger.
Get started
Install the NuGet package Quilt4Net.Toolkit.Api and register the service in Program.cs.
var builder = WebApplication.CreateBuilder(args);
builder.AddQuilt4NetLogging()
.AddHttpRequestLogging();
var app = builder.Build();
app.UseQuilt4NetLogging();
app.Run();
AddQuilt4NetLogging() configures OpenTelemetry resource attributes and registers per-record processors that tag every AppTrace / AppException / AppRequest with service.name, service.version, host.name, deployment.environment, and quilt4net.monitor (see the core Quilt4Net.Toolkit README for details). AddHttpRequestLogging() opts in to HTTP request/response middleware on top of that. By default, all requests to paths starting with /Api are logged.
The old
AddQuilt4NetApiLogging()andUseQuilt4NetApiLogging()methods still work but are deprecated.
Correlation ID
CorrelationIdMiddleware reads the X-Correlation-ID header from incoming requests; if no header is present, a new GUID is generated. The id is:
- Stored in
HttpContext.Items["CorrelationId"]for inspection by downstream code. - Returned in the response's
X-Correlation-IDheader — clients can chain the same id to subsequent requests for distributed tracing. - Pushed into a logging scope (
Logger.BeginScope({ ["CorrelationId"] = id })) for the duration of the request, so everyILoggercall made while handling the request inherits the id as a structured property. The Azure Monitor exporter writes it tocustomDimensions["CorrelationId"]on every resultingAppTrace/AppException/AppRequestrow.
KQL pattern for "show me everything from one call chain":
union AppTraces, AppExceptions, AppRequests
| where Properties contains "<your-correlation-id>"
| order by TimeGenerated asc
Or, in the toolkit's LogView Search tab, paste the id into the search box (it filters on both Message and CorrelationId). The Search tab's CorrelationId column also has a click-to-self-search shortcut — click any row's correlation chip and the grid re-runs scoped to that id.
Logging mode
Control where logs are sent using HttpRequestLogMode.
builder.AddQuilt4NetLogging()
.AddHttpRequestLogging(o =>
{
o.LogHttpRequest = HttpRequestLogMode.ApplicationInsights | HttpRequestLogMode.Logger;
});
| Value | Description |
|---|---|
None |
No logging. |
ApplicationInsights |
Append request/response data to Application Insights request telemetry. |
Logger |
Log via the standard ILogger pipeline. |
Values can be combined with | to log to multiple destinations.
Path filtering
By default, only paths matching ^/Api (case-insensitive) are logged. Override with regex patterns.
builder.AddQuilt4NetLogging()
.AddHttpRequestLogging(o =>
{
o.IncludePaths = [".*"]; // Log all paths
});
Per-endpoint control
Use [Logging] and [LoggingStream] attributes to override logging behavior on individual endpoints.
[Logging(RequestBody = true, ResponseBody = false)]
public async Task<IActionResult> StreamData() { ... }
[Logging(Enabled = false)]
public IActionResult InternalEndpoint() { ... }
[LoggingStream] // Shorthand for ResponseBody = false
public async Task<IActionResult> StreamEvents() { ... }
The [Logging] attribute can be applied to methods or classes.
| Property | Default | Description |
|---|---|---|
Enabled |
true |
Enable or disable all logging for the endpoint. |
RequestBody |
true |
Log the request body. |
ResponseBody |
true |
Log the response body. Set to false for streaming endpoints. |
Interceptor
Use an interceptor to modify or filter logged data before it is written. This is useful for removing sensitive information such as passwords or API keys.
builder.AddQuilt4NetLogging()
.AddHttpRequestLogging(o =>
{
o.Interceptor = async (request, response, properties, serviceProvider) =>
{
// Remove sensitive headers
request.Headers.Remove("Authorization");
return (request, response, properties);
};
});
Configuration
All options can be set via code or appsettings.json. Code takes priority over appsettings.json, which takes priority over defaults.
Code configuration
builder.AddQuilt4NetLogging()
.AddHttpRequestLogging(o =>
{
o.LogHttpRequest = HttpRequestLogMode.ApplicationInsights;
o.UseCorrelationId = true;
o.MaxBodySize = 5_000_000;
o.IncludePaths = ["^/Api", "^/webhook"];
o.LogRequestBodyByDefault = true;
o.LogResponseBodyByDefault = false;
});
appsettings.json
{
"Quilt4Net": {
"ApiLogging": {
"LogHttpRequest": 1,
"UseCorrelationId": true,
"MonitorName": "Quilt4Net",
"MaxBodySize": 1000000,
"IncludePaths": ["^/Api"],
"LogRequestBodyByDefault": true,
"LogResponseBodyByDefault": false
}
}
}
Configuration path: Quilt4Net:ApiLogging
LoggingOptions
| Property | Default | Description |
|---|---|---|
LogHttpRequest |
ApplicationInsights |
Logging destination. Combine with \| for multiple. |
UseCorrelationId |
true |
Enable X-Correlation-ID header tracking. |
MonitorName |
"Quilt4Net" |
Monitor name for tracking log items. Set to empty to omit. |
MaxBodySize |
1 MB |
Maximum body size to log. Set to 0 to disable body logging. |
IncludePaths |
["^/Api"] |
Regex patterns (case-insensitive) for paths to include. |
LogRequestBodyByDefault |
true |
Log request body by default. Override per endpoint with [Logging]. |
LogResponseBodyByDefault |
false |
Log response body by default. Override per endpoint with [Logging]. |
Interceptor |
null |
Callback to modify or filter logged data before writing. |
Logged data
Request
| Field | Description |
|---|---|
Method |
HTTP method (GET, POST, etc.). |
Path |
Request path. |
Headers |
Request headers (cookies are automatically filtered). |
Query |
Query string parameters. |
Body |
Request body (respects MaxBodySize limit). |
ClientIp |
Client IP address. |
Response
| Field | Description |
|---|---|
StatusCode |
HTTP status code. |
Headers |
Response headers. |
Body |
Response body (respects MaxBodySize limit). |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Quilt4Net.Toolkit (>= 0.7.12)
-
net8.0
- Quilt4Net.Toolkit (>= 0.7.12)
-
net9.0
- Quilt4Net.Toolkit (>= 0.7.12)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.7.12 | 0 | 5/11/2026 |
| 0.7.11 | 0 | 5/11/2026 |
| 0.7.10 | 37 | 5/10/2026 |
| 0.7.9 | 40 | 5/10/2026 |
| 0.7.8 | 50 | 5/9/2026 |
| 0.7.7 | 40 | 5/9/2026 |
| 0.7.6 | 59 | 5/6/2026 |
| 0.7.5 | 62 | 5/6/2026 |
| 0.7.4 | 115 | 4/30/2026 |
| 0.7.3 | 121 | 4/22/2026 |
| 0.7.2 | 98 | 4/20/2026 |
| 0.7.1 | 93 | 4/20/2026 |
| 0.7.0 | 92 | 4/19/2026 |
| 0.6.18 | 90 | 4/19/2026 |
| 0.6.17 | 94 | 4/19/2026 |
| 0.6.16 | 123 | 4/18/2026 |
| 0.6.15 | 104 | 4/18/2026 |
| 0.6.14 | 95 | 4/17/2026 |
| 0.6.13 | 101 | 4/15/2026 |
| 0.6.12 | 118 | 4/9/2026 |