Destructurama.FSharp 2.0.0

dotnet add package Destructurama.FSharp --version 2.0.0                
NuGet\Install-Package Destructurama.FSharp -Version 2.0.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="Destructurama.FSharp" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Destructurama.FSharp --version 2.0.0                
#r "nuget: Destructurama.FSharp, 2.0.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 Destructurama.FSharp as a Cake Addin
#addin nuget:?package=Destructurama.FSharp&version=2.0.0

// Install Destructurama.FSharp as a Cake Tool
#tool nuget:?package=Destructurama.FSharp&version=2.0.0                

Destructurama.FSharp

ATTENTION! Looking for maintainers

See https://github.com/destructurama/fsharp/issues/34

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

Native support for destructuring F# types when logging to Serilog.

Installation

Install from NuGet:

dotnet add package Destructurama.FSharp

Usage

Add Destructure.FSharpTypes() to your logger configuration:

open Serilog

[<EntryPoint>]
let main argv = 

    Log.Logger <- LoggerConfiguration()
        .Destructure.FSharpTypes()
        .WriteTo.Console()
        .CreateLogger()

    Log.Information("Drawing a {@Shape}", Circle 5.)

    0

Discriminated unions like:

type Shape =
    | Circle of Radius : double
    | Rectangle of Width : double *  Height : double
    | Arc // ...
let shape = Circle 5.

When logged with Serilog:

Log.Information("Drawing a {@Shape}", shape)

Are printed nicely like:

2015-01-14 16:58:31 [Information] Drawing a Circle { Radius: 5 }

Depending on the log storage you use you will be able to query on the tag as well as the fields (like Radius) from the union.

More samples can be seen by running the project in the Samples folder using dotnet run. Doing so will destructure a union, record, and a tuple with and without this package to highlight the difference:

➜  samples git:(records) ✗ dotnet run
[13:35:19 INF] Printing a {"quantity": 10, "label": "hi", "Tag": 2, "IsA": false, "IsB": false, "IsC": true, "$type": "C"} with poor destructuring
[13:35:19 INF] Printing a {"quantity": 10, "label": "hi", "$type": "C"} with better destructuring

[13:35:19 INF] Printing a {"FieldA": 10, "OtherField": true, "AnotherOne": {"quantity": 10, "label": "hi", "Tag": 2, "IsA": false, "IsB": false, "IsC": true, "$type": "C"}, "$type": "MyRecord"} with poor destructuring
[13:35:19 INF] Printing a {"FieldA": 10, "OtherField": true, "AnotherOne": {"quantity": 10, "label": "hi", "$type": "C"}, "$type": "MyRecord"} with better destructuring

[13:35:19 INF] Printing a {"Item1": 1, "Item2": "hi", "$type": "Tuple`2"} with poor destructuring
[13:35:19 INF] Printing a [1, "hi"] with better destructuring
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Destructurama.FSharp:

Package Downloads
Serilog.Extras.FSharp

Obsolete. Please install Destructurama.FSharp.

Exira.EbsBackup

Exira.EbsBackup is a console application which backs up EBS volumes on a rotating schedule

Monazita

An F# library to query your Postgresql database writing sql queries using a printf format.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Destructurama.FSharp:

Repository Stars
oskardudycz/EventSourcing.NetCore
Examples and Tutorials of Event Sourcing in .NET
Version Downloads Last updated
2.0.0 29,307 1/30/2024
1.2.0 219,492 9/30/2021
1.2.0-dev-00047 338 9/20/2021
1.1.2-dev-00045 2,623 7/14/2021
1.1.1-dev-00043 66,681 5/11/2021
1.1.1-dev-00042 251 5/11/2021
1.1.1-dev-00035 66,892 1/14/2020
1.1.1-dev-00033 41,139 10/30/2019
1.1.0 16,997 10/29/2019
1.1.0-dev-00025 408 10/29/2019
1.1.0-dev-00023 3,489 8/11/2019
1.0.14 105,887 6/8/2015
1.0.13 1,045 6/8/2015
1.0.10 1,099 6/7/2015
1.0.8 1,086 6/6/2015
1.0.6 1,219 4/1/2015
1.0.5 1,134 3/29/2015
1.0.4 14,922 3/29/2015