Sstv.DomainExceptions.Extensions.SerilogEnricher 2.2.0

dotnet add package Sstv.DomainExceptions.Extensions.SerilogEnricher --version 2.2.0
NuGet\Install-Package Sstv.DomainExceptions.Extensions.SerilogEnricher -Version 2.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Sstv.DomainExceptions.Extensions.SerilogEnricher" Version="2.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Sstv.DomainExceptions.Extensions.SerilogEnricher --version 2.2.0
#r "nuget: Sstv.DomainExceptions.Extensions.SerilogEnricher, 2.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Sstv.DomainExceptions.Extensions.SerilogEnricher as a Cake Addin
#addin nuget:?package=Sstv.DomainExceptions.Extensions.SerilogEnricher&version=2.2.0

// Install Sstv.DomainExceptions.Extensions.SerilogEnricher as a Cake Tool
#tool nuget:?package=Sstv.DomainExceptions.Extensions.SerilogEnricher&version=2.2.0

Sstv.DomainExceptions.Extensions.SerilogEnricher

<- root readme

<- changelog

This library integrates Sstv.DomainExceptions with Serilog using it's enrich feature. When you write to log, serilog can attach some extra data to you logging message. So when exception logged, we can add an error code and user provided additional data from exception instance to the current logging scope.

Install

You can install using Nuget Package Manager:

Install-Package Sstv.DomainExceptions.Extensions.SerilogEnricher -Version 2.2.0

via the .NET CLI:

dotnet add package Sstv.DomainExceptions.Extensions.SerilogEnricher --version 2.2.0

or you can add package reference manually:

<PackageReference Include="Sstv.DomainExceptions.Extensions.SerilogEnricher" Version="2.2.0" />

How to use?

When you configuring your Serilog logger, add enricher via method WithDomainException e.g.:

 public static class HostBuilderExtensions
 {
     public static IHostBuilder UseSerilog(this IHostBuilder hostBuilder)
     {
         return hostBuilder.UseSerilog((hostingContext, loggerConfiguration) =>
         {
             var serviceName = hostingContext.Configuration.GetValue<string>("ServiceName");
             var hostName = hostingContext.Configuration.GetValue<string>("HOSTNAME");

             loggerConfiguration
                 .MinimumLevel.Information()
                 .MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
                 .MinimumLevel.Override("System", LogEventLevel.Warning)
                 .Enrich.WithProperty("Service", serviceName)
                 .Enrich.WithProperty("Host", hostName)
+                .Enrich.WithDomainException()
                 .WriteTo.Console();
         });
     }
 }
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
2.2.0 88 2/18/2024
2.1.1 78 2/14/2024
2.1.0 90 2/12/2024
1.0.0 125 10/4/2023