Skip to content

Adds support for logging System.Text.Json dynamic types as structured data with Serilog

License

Notifications You must be signed in to change notification settings

destructurama/system-text-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Destructurama.SystemTextJson

License

codecov Nuget Nuget

GitHub Release Date GitHub commits since latest release (by date) Size

GitHub contributors Activity Activity Activity

Run unit tests Publish preview to GitHub registry Publish release to Nuget registry CodeQL analysis

Adds support for logging System.Text.Json dynamic types as structured data with Serilog. For JSON.NET dynamic types see this repo.

Installation

Install from NuGet:

Install-Package Destructurama.SystemTextJson

Usage

Modify logger configuration:

var log = new LoggerConfiguration()
  .Destructure.SystemTextJsonTypes()
  ...

Any System.Text.Json dynamic object can be represented in the log event's properties:

var obj = JsonSerializer.Deserialize<dynamic>(someJson);
Log.Information("Deserialized {@Obj}", obj);

Benchmarks

The results are available here.

About

Adds support for logging System.Text.Json dynamic types as structured data with Serilog

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages