Jakar.Json.Logging
10.3.0
dotnet add package Jakar.Json.Logging --version 10.3.0
NuGet\Install-Package Jakar.Json.Logging -Version 10.3.0
<PackageReference Include="Jakar.Json.Logging" Version="10.3.0" />
<PackageVersion Include="Jakar.Json.Logging" Version="10.3.0" />
<PackageReference Include="Jakar.Json.Logging" />
paket add Jakar.Json.Logging --version 10.3.0
#r "nuget: Jakar.Json.Logging, 10.3.0"
#:package Jakar.Json.Logging@10.3.0
#addin nuget:?package=Jakar.Json.Logging&version=10.3.0
#tool nuget:?package=Jakar.Json.Logging&version=10.3.0
Jakar.Json.Logging
A JSON console formatter for Microsoft.Extensions.Logging that writes [JsonModel] values as structured JSON, using Jakar.Json.
builder.Logging.AddJakarJsonConsole(o => o.IncludeScopes = true);
logger.LogInformation("Placed {Order}", order);
{"Timestamp":"...","EventId":0,"LogLevel":"Information","Category":"Orders","Message":"Placed Order { Id = 7, ... }",
"State":{"Message":"...","Order":{"id" : 7,"customer" : "Zoë","total" : 12.50,"lines" : [...]},"{OriginalFormat}":"Placed {Order}"}}
- Shape: each entry has the same fields as the built-in
JsonConsoleFormatter. Log pipelines that read it keep working. - Models:
[JsonModel]values in the state and scopes, and arrays, lists and collection interfaces of them, are JSON objects and arrays written by Jakar.Json, not theirToString(). - Other values: numbers and booleans stay JSON numbers and booleans, and other values are written as their invariant text. NaN and infinities are written as text, so a log line is always valid JSON.
- Options: the console formatter's (
IncludeScopes,TimestampFormat,UseUtcTimestamp), plusIndentedandEscaping. The whole entry is written by Jakar.Json; System.Text.Json isn't involved.
Registration binds options from configuration, as AddConsoleFormatter does, so it's annotated as not trimming-safe.
| Product | Versions 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. |
-
net10.0
- Jakar.Json (>= 10.3.0)
- Microsoft.Extensions.Logging.Console (>= 10.0.13)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
10.3.0 (breaking): the entry is written by Jakar.Json's writer, with no System.Text.Json; JakarJsonConsoleFormatterOptions derives from ConsoleFormatterOptions and has Indented and Escaping instead of JsonWriterOptions. Built against Jakar.Json 10.3.0. 10.2.0: built against Jakar.Json 10.2.0, whose writers take a ref TWriter; 10.1.0 calls the removed IBufferWriter overloads and throws MissingMethodException with Jakar.Json 10.2.0. 10.1.0: initial release.