Skip to content

Instantly share code, notes, and snippets.

View beppemarazzi's full-sized avatar

Giuseppe Marazzi beppemarazzi

  • Tecnoferrari SPA
View GitHub Profile
@beppemarazzi
beppemarazzi / JsonDocumentDestructuringPolicy.cs
Last active October 23, 2023 18:39 — forked from nblumhardt/JsonDocumentDestructuringPolicy.cs
Properly serialize System.Text.Json documents with Serilog
using System;
using System.Linq;
using System.Text.Json;
using Serilog.Core;
using Serilog.Events;
class JsonDocumentDestructuringPolicy : IDestructuringPolicy
{
public bool TryDestructure(object value, ILogEventPropertyValueFactory _, out LogEventPropertyValue result)
{