Serilog.Enrichers.Waystone.WideLogEvents.AspNetCore
5.1.0-wide-events.3
See the version list below for details.
dotnet add package Serilog.Enrichers.Waystone.WideLogEvents.AspNetCore --version 5.1.0-wide-events.3
NuGet\Install-Package Serilog.Enrichers.Waystone.WideLogEvents.AspNetCore -Version 5.1.0-wide-events.3
<PackageReference Include="Serilog.Enrichers.Waystone.WideLogEvents.AspNetCore" Version="5.1.0-wide-events.3" />
<PackageVersion Include="Serilog.Enrichers.Waystone.WideLogEvents.AspNetCore" Version="5.1.0-wide-events.3" />
<PackageReference Include="Serilog.Enrichers.Waystone.WideLogEvents.AspNetCore" />
paket add Serilog.Enrichers.Waystone.WideLogEvents.AspNetCore --version 5.1.0-wide-events.3
#r "nuget: Serilog.Enrichers.Waystone.WideLogEvents.AspNetCore, 5.1.0-wide-events.3"
#:package Serilog.Enrichers.Waystone.WideLogEvents.AspNetCore@5.1.0-wide-events.3
#addin nuget:?package=Serilog.Enrichers.Waystone.WideLogEvents.AspNetCore&version=5.1.0-wide-events.3&prerelease
#tool nuget:?package=Serilog.Enrichers.Waystone.WideLogEvents.AspNetCore&version=5.1.0-wide-events.3&prerelease
Serilog.Enrichers.Waystone.WideLogEvents.AspNetCore
Provides ASP.NET Core integration for Waystone.WideLogEvents, allowing you to
automatically capture request and response details and include them in your
Serilog logs.
Installation
Install the NuGet package:
dotnet add package Serilog.Enrichers.Waystone.WideLogEvents.AspNetCore
This package transitively includes Waystone.WideLogEvents and
Serilog.Enrichers.Waystone.WideLogEvents.
Usage
1. Configure Serilog
In your Program.cs, configure Serilog to use the Wide Log Events enricher:
using Serilog;
using Serilog.Enrichers.Waystone.WideLogEvents;
builder.Host.UseSerilog((context, config) => config.Enrich
.FromWideLogEventsContext()
.ReadFrom.Configuration(context.Configuration));
2. Register Middleware
Add the UseWideLogEvents middleware to your application pipeline. This
middleware should typically be placed early in the pipeline to capture as much
information as possible.
using Serilog.Enrichers.Waystone.WideLogEvents.AspNetCore;
var app = builder.Build();
app.UseWideLogEvents();
// ... other middleware
3. Use in Endpoints
You can now push properties to the WideLogEventContext anywhere in your
request lifecycle (e.g., in Controllers, Minimal API handlers, or Services):
using Waystone.WideLogEvents;
app.MapGet("/weatherforecast", () =>
{
var forecast = // ... get forecast
// This property will be included in the final "wide" log for this request
WideLogEventContext.PushProperty("ForecastCount", forecast.Length);
return forecast;
});
Configuration Options
You can customize the behavior of the middleware. You can either replace the
default delegates or append to them using the += operator:
app.UseWideLogEvents(options =>
{
// Append custom logic to the default request property capture
options.OnBeforeInvokeNext += (scope, context) =>
{
scope.PushProperty("TraceId", context.TraceIdentifier);
};
// Custom sampler logic (defaults to logging everything)
options.Sampler = new MyCustomSampler();
});
Features
- Automatic Request Capture: Captures Method, Path, Scheme, Host, ContentType, etc.
- Automatic Response Capture: Captures StatusCode, ContentType, etc.
- Outcome Tracking: Automatically sets the outcome to
SuccessorFailure(including the Exception). - Duration Tracking: Logs the total time taken for the request to be processed.
- Sampling: Built-in support for sampling logs based on outcome or other properties.
| 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 was computed. 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
- Serilog.Enrichers.Waystone.WideLogEvents (>= 5.1.0-wide-events.3)
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.2)
- Serilog.Enrichers.Waystone.WideLogEvents (>= 5.1.0-wide-events.3)
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 |
|---|---|---|
| 5.1.1 | 1,283 | 2/6/2026 |
| 5.1.0 | 135 | 2/6/2026 |
| 5.1.0-wide-events.5 | 389 | 2/4/2026 |
| 5.1.0-wide-events.4 | 79 | 2/4/2026 |
| 5.1.0-wide-events.3 | 83 | 2/2/2026 |
| 5.1.0-wide-events.2 | 80 | 2/2/2026 |
| 5.1.0-wide-events.1 | 84 | 2/1/2026 |