![]() |
VOOZH | about |
dotnet add package Serilog.Formatting.Compact.Reader --version 4.0.0
NuGet\Install-Package Serilog.Formatting.Compact.Reader -Version 4.0.0
<PackageReference Include="Serilog.Formatting.Compact.Reader" Version="4.0.0" />
<PackageVersion Include="Serilog.Formatting.Compact.Reader" Version="4.0.0" />Directory.Packages.props
<PackageReference Include="Serilog.Formatting.Compact.Reader" />Project file
paket add Serilog.Formatting.Compact.Reader --version 4.0.0
#r "nuget: Serilog.Formatting.Compact.Reader, 4.0.0"
#:package Serilog.Formatting.Compact.Reader@4.0.0
#addin nuget:?package=Serilog.Formatting.Compact.Reader&version=4.0.0Install as a Cake Addin
#tool nuget:?package=Serilog.Formatting.Compact.Reader&version=4.0.0Install as a Cake Tool
This package reads (deserializes) JSON log files created by Serilog.Formatting.Compact back into Serilog LogEvents.
Log events are written to a file using CompactJsonFormatter:
await using var fileLog = new LoggerConfiguration()
.WriteTo.File(new CompactJsonFormatter(), "log.clef")
.CreateLogger();
fileLog.Information("Hello, {@User}", new { Name = "nblumhardt", Id = 101 });
fileLog.Information("Number {N:x8}", 42);
fileLog.Warning("Tags are {Tags}", new[] { "test", "orange" });
try
{
throw new DivideByZeroException();
}
catch(Exception ex)
{
fileLog.Error(ex, "Something failed");
}
This creates a log file with content similar to:
{"@t":"2024-10-12T04:46:58.0554314Z","@mt":"Hello, {@User}","User":{"Name":"nblumhardt","Id":101}}
{"@t":"2024-10-12T04:46:58.0684369Z","@mt":"Number {N:x8}","@r":["0000002a"],"N":42}
{"@t":"2024-10-12T04:46:58.0724384Z","@mt":"Tags are {Tags}","@l":"Warning","Tags":["test","orange"]}
{"@t":"2024-10-12T04:46:58.0904378Z","@mt":"Something failed","@l":"Error", "@x":"System.DivideByZer...<snip>"}
An instance of LogEventReader converts each line of the log file back into a LogEvent, which can be manipulated, rendered, or written through another Serilog sink:
await using var console = new LoggerConfiguration()
.WriteTo.Console()
.CreateLogger();
await using var clef = File.OpenText("log.clef"))
var reader = new LogEventReader(clef);
while (reader.TryRead(out var evt))
console.Write(evt);
Output from the logger:
Events deserialized from JSON are for typical purposes just like the original log events. There are two main things to keep in mind:
int or a float. JSON.NET does a good job of deserializing anything that it encounters, but you can't rely on the types here being identical.ToString() to get the formatted message and stack trace, which is what 99% of Serilog sinks will do.| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 is compatible. net463 net463 was computed. net47 net47 was computed. net471 net471 is compatible. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on Serilog.Formatting.Compact.Reader:
| Package | Downloads |
|---|---|
|
Umbraco.Cms.Web.Common
Contains the web assembly needed to run Umbraco CMS. |
|
|
Umbraco.Cms.Infrastructure
Contains the infrastructure assembly needed to run Umbraco CMS. |
|
|
Umbraco.Cms.Examine.Lucene
Adds Examine searching support using Lucene to Umbraco CMS. |
|
|
Umbraco.Cms.Web.Website
Contains the website assembly needed to run the frontend of Umbraco CMS. |
|
|
Nuke.Build
The AKEless Build System for C#/.NET Signed by signpath.io from repository 'https://github.com/nuke-build/nuke' commit '8aaec258a7e00e5d98e013be025db1a42bc58d79' (see contained AppVeyorSettings.json file for build settings). |
Showing the top 7 popular GitHub repositories that depend on Serilog.Formatting.Compact.Reader:
| Repository | Stars |
|---|---|
|
umbraco/Umbraco-CMS
Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
|
|
|
nuke-build/nuke
🏗 The AKEless Build System for C#/.NET
|
|
|
ErsatzTV/legacy
Open-source platform that transforms your personal media library into live, custom TV channels.
|
|
|
SparkDevNetwork/Rock
An open source CMS, Relationship Management System (RMS) and Church Management System (ChMS) all rolled into one.
|
|
|
datalust/seqcli
The Seq command-line client. Administer, log, ingest, search, from any OS.
|
|
|
datalust/clef-tool
A command-line tool for manipulating Compact Log Event Format files
|
|
|
Shazwazza/UmbracoIdentity
ASP.NET Identity implementation for Umbraco's native member data
|
| Version | Downloads | Last Updated |
|---|---|---|
| 4.1.0-dev-00085 | 5,279 | 8/5/2024 |
| 4.1.0-dev-00082 | 600 | 7/16/2024 |
| 4.0.1-dev-00081 | 268 | 7/16/2024 |
| 4.0.1-dev-00079 | 289 | 7/14/2024 |
| 4.0.0 | 7,786,930 | 7/2/2024 |
| 4.0.0-dev-00071 | 277 | 7/2/2024 |
| 3.0.0 | 8,331,007 | 11/9/2023 |
| 3.0.0-dev-00063 | 529 | 10/3/2023 |
| 2.0.0 | 4,131,156 | 11/3/2022 |
| 2.0.0-dev-00060 | 398 | 10/30/2022 |
| 1.0.6-dev-00059 | 576 | 10/28/2022 |
| 1.0.5 | 19,449,201 | 4/29/2021 |
| 1.0.5-dev-00048 | 636 | 4/27/2021 |
| 1.0.4 | 218,762 | 3/8/2021 |
| 1.0.3 | 2,613,578 | 11/5/2018 |
| 1.0.3-dev-00036 | 1,405 | 9/22/2018 |
| 1.0.3-dev-00034 | 1,770 | 5/9/2018 |
| 1.0.3-dev-00033 | 1,676 | 3/21/2018 |
| 1.0.2 | 282,867 | 2/5/2018 |
| 1.0.2-dev-00024 | 1,449 | 8/29/2017 |