Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rehansaeed/serilog.enrichers.span
Enrich Serilog log events with properties from Open Telemetry spans.
https://github.com/rehansaeed/serilog.enrichers.span
activity c-sharp cncf dotnet dotnet-core logging metrics nuget open-telemetry open-telemetry-csharp serilog span tracing
Last synced: about 1 month ago
JSON representation
Enrich Serilog log events with properties from Open Telemetry spans.
- Host: GitHub
- URL: https://github.com/rehansaeed/serilog.enrichers.span
- Owner: RehanSaeed
- License: mit
- Created: 2020-11-20T09:31:46.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-12-21T17:53:58.000Z (11 months ago)
- Last Synced: 2024-10-09T20:04:45.481Z (about 1 month ago)
- Topics: activity, c-sharp, cncf, dotnet, dotnet-core, logging, metrics, nuget, open-telemetry, open-telemetry-csharp, serilog, span, tracing
- Language: C#
- Homepage:
- Size: 216 KB
- Stars: 95
- Watchers: 5
- Forks: 19
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
![Banner](https://github.com/RehanSaeed/Serilog.Enrichers.Span/blob/main/Images/Banner.png)
[![Serilog.Enrichers.Span NuGet Package](https://img.shields.io/nuget/v/Serilog.Enrichers.Span.svg)](https://www.nuget.org/packages/Serilog.Enrichers.Span/) [![Serilog.Enrichers.Span package in serilog-exceptions feed in Azure Artifacts](https://feeds.dev.azure.com/serilog-exceptions/_apis/public/Packaging/Feeds/8479813c-da6b-4677-b40d-78df8725dc9c/Packages/3f8a2a7e-8124-4987-9c44-916dba83b9d6/Badge)](https://dev.azure.com/serilog-exceptions/Serilog.Enrichers.Span/_packaging?_a=package&feed=8479813c-da6b-4677-b40d-78df8725dc9c&package=3f8a2a7e-8124-4987-9c44-916dba83b9d6&preferRelease=true) [![Serilog.Enrichers.Span NuGet Package Downloads](https://img.shields.io/nuget/dt/Serilog.Enrichers.Span)](https://www.nuget.org/packages/Serilog.Enrichers.Span) [![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/RehanSaeedUK) [![Twitter Follow](https://img.shields.io/twitter/follow/rehansaeeduk.svg?style=social&label=Follow)](https://twitter.com/RehanSaeedUK)
Enrich Serilog log events with properties from open telemetry spans using .NET's [Activity](https://docs.microsoft.com/dotnet/api/system.diagnostics.activity) API.
# :exclamation: Important
This repository is now deprecated. Serilog now has the native ability to log span related data. See [#332](https://github.com/RehanSaeed/Serilog.Enrichers.Span/issues/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](https://serilog.net) to log exception details and custom properties that are not output in `Exception.ToString()`.
# Getting Started
Add the [Serilog.Enrichers.Span](https://www.nuget.org/packages/Serilog.Enrichers.Span/) NuGet package.
```powershell
dotnet add package Serilog.Enrichers.Span
```When setting up your logger, add the `WithSpan()` line like so:
```cs
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](https://dev.azure.com/serilog-exceptions/Serilog.Enrichers.Span/_apis/build/status/RehanSaeed.Serilog.Enrichers.Span?branchName=main&stageName=Build&jobName=Build&configuration=Build%20Linux)](https://dev.azure.com/serilog-exceptions/Serilog.Enrichers.Span/_build/latest?definitionId=2&branchName=main) |
| Azure Pipelines | Mac | [![Azure Pipelines Mac Build Status](https://dev.azure.com/serilog-exceptions/Serilog.Enrichers.Span/_apis/build/status/RehanSaeed.Serilog.Enrichers.Span?branchName=main&stageName=Build&jobName=Build&configuration=Build%20Mac)](https://dev.azure.com/serilog-exceptions/Serilog.Enrichers.Span/_build/latest?definitionId=2&branchName=main) |
| Azure Pipelines | Windows | [![Azure Pipelines Windows Build Status](https://dev.azure.com/serilog-exceptions/Serilog.Enrichers.Span/_apis/build/status/RehanSaeed.Serilog.Enrichers.Span?branchName=main&stageName=Build&jobName=Build&configuration=Build%20Windows)](https://dev.azure.com/serilog-exceptions/Serilog.Enrichers.Span/_build/latest?definitionId=2&branchName=main) |
| Azure Pipelines | Overall | [![Azure Pipelines Overall Build Status](https://dev.azure.com/serilog-exceptions/Serilog.Enrichers.Span/_apis/build/status/RehanSaeed.Serilog.Enrichers.Span?branchName=main)](https://dev.azure.com/serilog-exceptions/Serilog.Enrichers.Span/_build/latest?definitionId=2&branchName=main) | [![Azure DevOps Build History](https://buildstats.info/azurepipelines/chart/serilog-exceptions/Serilog.Enrichers.Span/2?branch=main&includeBuildsFromPullRequest=false)](https://dev.azure.com/serilog-exceptions/Serilog.Enrichers.Span/_build/latest?definitionId=2&branchName=main) |
| GitHub Actions | Ubuntu, Mac & Windows | [![GitHub Actions Status](https://github.com/RehanSaeed/Serilog.Enrichers.Span/workflows/Build/badge.svg?branch=main)](https://github.com/RehanSaeed/Serilog.Enrichers.Span/actions) | [![GitHub Actions Build History](https://buildstats.info/github/chart/RehanSaeed/Serilog.Enrichers.Span?branch=main&includeBuildsFromPullRequest=false)](https://github.com/RehanSaeed/Serilog.Enrichers.Span/actions) |
| AppVeyor | Ubuntu, Mac & Windows | [![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/gd9pt19ekymmr79g?svg=true)](https://ci.appveyor.com/project/RehanSaeed/serilog-enrichers-span) | [![AppVeyor Build History](https://buildstats.info/appveyor/chart/RehanSaeed/serilog-enrichers-span?branch=main&includeBuildsFromPullRequest=false)](https://ci.appveyor.com/project/RehanSaeed/serilog-enrichers-span) |## Contributions and Thanks
Please view the [contributing guide](https://github.com/RehanSaeed/Serilog.Enrichers.Span/blob/main/.github/CONTRIBUTING.md) for more information.