Serilog.Enrichers.Span
Serilog.Enrichers.Span copied to clipboard
Enrich Serilog log events with properties from Open Telemetry spans.
Enrich Serilog log events with properties from open telemetry spans using .NET's Activity API.
What Does It Do?
Enriches logs with a spans unique identifier, parent unique identifier and ASP.NET's trace unique identifier. Serilog.Enrichers.Span
is an add-on to Serilog to log exception details and custom properties that are not output in Exception.ToString()
.
Getting Started
Add the Serilog.Enrichers.Span NuGet package.
dotnet add package Serilog.Enrichers.Span
When setting up your logger, add the WithSpan()
line like so:
using Serilog;
using Serilog.Enrichers.Span;
ILogger logger = new LoggerConfiguration()
.Enrich.WithSpan()
.WriteTo.RollingFile(
new JsonFormatter(renderMessage: true),
@"C:\logs\log-{Date}.txt")
.CreateLogger();
Continuous Integration
Name | Operating System | Status | History |
---|---|---|---|
Azure Pipelines | Ubuntu | ||
Azure Pipelines | Mac | ||
Azure Pipelines | Windows | ||
Azure Pipelines | Overall | ||
GitHub Actions | Ubuntu, Mac & Windows | ||
AppVeyor | Ubuntu, Mac & Windows |
Contributions and Thanks
Please view the contributing guide for more information.