CodoMetis.TypeKit.Serilog 2.2.0

Prefix Reserved
dotnet add package CodoMetis.TypeKit.Serilog --version 2.2.0
                    
NuGet\Install-Package CodoMetis.TypeKit.Serilog -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="CodoMetis.TypeKit.Serilog" Version="2.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CodoMetis.TypeKit.Serilog" Version="2.2.0" />
                    
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 2.2.0
                    
#r "nuget: CodoMetis.TypeKit.Serilog, 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.
#:package CodoMetis.TypeKit.Serilog@2.2.0
                    
#: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=2.2.0
                    
Install as a Cake Addin
#tool nuget:?package=CodoMetis.TypeKit.Serilog&version=2.2.0
                    
Install as a Cake Tool

CodoMetis.TypeKit.Serilog

Serilog logs your CodoMetis.TypeKit value objects and closed sets as what they print, also where it destructures them. A value object that masks itself stays masked.

dotnet add package CodoMetis.TypeKit.Serilog

It needs Serilog 4.0.0 or later.

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 you need it. 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 package, a value object that masks itself with a hand-written ToString() is logged unmasked there, as { Value: "k-123" }. That is the only place it leaks. With the package, Serilog logs value objects as their text, as Microsoft.Extensions.Logging does.
  • Every value object becomes a string, masked or not. An OrderId is "0199aaaa-...", not { Value: "0199aaaa-..." }, and a Quantity is "3". A list or a dictionary of them becomes a list or a dictionary of strings.
  • A closed set is logged as its name, or as what its own ToString() prints, never by its properties. {@Order} holds Status: "Shipped", not the set's constant data. An instance that the set's own code made beside its members has no name, and Serilog logs that it could not capture it.
  • Nothing to register per type. The package recognises a value object or a closed set by the attribute the generators put on it. So the host needs this package and the base package, not the generators. Serilog handles every other type as before.
  • To mask a value object, write its ToString(). The Generators README says what else still carries the value then.
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
2.2.0 92 10/18/2026
2.1.0 1,170 10/15/2026
2.0.0 126 10/14/2026
1.5.1 102 10/11/2026
1.5.0 84 10/11/2026