Skip to content

RehanSaeed/Serilog.Enrichers.Span

Folders and files

NameName
Last commit message
Last commit date

Latest commit

6ddf8f4 · Oct 5, 2023
Jun 1, 2023
Nov 20, 2020
Jan 10, 2023
Jun 1, 2023
Nov 9, 2021
Nov 20, 2020
Nov 20, 2020
May 17, 2023
Feb 22, 2023
Nov 20, 2020
Nov 20, 2020
Oct 5, 2023
Jun 30, 2021
Nov 22, 2021
Nov 9, 2022
Nov 16, 2022
Nov 9, 2022
May 17, 2023

Repository files navigation

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.

❗ Important

This repository is now deprecated. Serilog now has the native ability to log span related data. See #332.

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.