CodoMetis.TypeKit.Serilog 1.5.1

Prefix Reserved
dotnet add package CodoMetis.TypeKit.Serilog --version 1.5.1
                    
NuGet\Install-Package CodoMetis.TypeKit.Serilog -Version 1.5.1
                    
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="CodoMetis.TypeKit.Serilog" Version="1.5.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CodoMetis.TypeKit.Serilog" Version="1.5.1" />
                    
Directory.Packages.props
<PackageReference Include="CodoMetis.TypeKit.Serilog" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CodoMetis.TypeKit.Serilog --version 1.5.1
                    
#r "nuget: CodoMetis.TypeKit.Serilog, 1.5.1"
                    
#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.
#:package CodoMetis.TypeKit.Serilog@1.5.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CodoMetis.TypeKit.Serilog&version=1.5.1
                    
Install as a Cake Addin
#tool nuget:?package=CodoMetis.TypeKit.Serilog&version=1.5.1
                    
Install as a Cake Tool

CodoMetis.TypeKit.Serilog

Serilog integration for CodoMetis.TypeKit value objects: each is logged as what it prints, also where Serilog destructures it.

dotnet add package CodoMetis.TypeKit.Serilog
using Serilog;

using var logger = new LoggerConfiguration()
    .Destructure.WithTypeKit()
    .WriteTo.Console()
    .CreateLogger();

logger.Information("Created {@Client}", new Client(ApiKey.From("k-123"), "Ann"));   // Created {"Key": "ApiKey(***)", "Name": "Ann", "$type": "Client"}
  • Why. Serilog destructures an object ({@Key}, or a record holding one) by reading its public properties, and a value object's Value is public: without this, a value object that masks itself with a hand-written ToString() is logged unmasked there, as { Value: "k-123" }, and nowhere else. With it, Serilog logs value objects as Microsoft.Extensions.Logging does, as their text.
  • Every value object, masked or not, is then a string in the event: an OrderId is "0199aaaa-…", not { Value: "0199aaaa-…" }, and a Quantity is "3". A list or dictionary of them is a list or dictionary of strings.
  • Nothing per type. A value object is recognised by the attribute the generators put on it, so the host needs this package and the base package, not the generators. Other types are left to Serilog.
  • To mask a value object, declare ToString(); the Generators README says what else then still carries the value.
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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
1.5.1 47 10/11/2026
1.5.0 58 10/11/2026