Skip to content

Latest commit

 

History

History
46 lines (32 loc) · 4.94 KB

README.md

File metadata and controls

46 lines (32 loc) · 4.94 KB

Banner

Serilog.Enrichers.Span NuGet Package Serilog.Enrichers.Span package in serilog-exceptions feed in Azure Artifacts Serilog.Enrichers.Span NuGet Package Downloads Twitter URL Twitter Follow

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 Ubuntu Build Status
Azure Pipelines Mac Azure Pipelines Mac Build Status
Azure Pipelines Windows Azure Pipelines Windows Build Status
Azure Pipelines Overall Azure Pipelines Overall Build Status Azure DevOps Build History
GitHub Actions Ubuntu, Mac & Windows GitHub Actions Status GitHub Actions Build History
AppVeyor Ubuntu, Mac & Windows AppVeyor Build status AppVeyor Build History

Contributions and Thanks

Please view the contributing guide for more information.