You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A simple, compact JSON-based event format for Serilog. `CompactJsonFormatter` significantly reduces the byte count of small log events when compared with Serilog's default `JsonFormatter`, while remaining human-readable. It achieves this through shorter built-in property names, a leaner format, and by excluding redundant information.
4
4
@@ -15,16 +15,44 @@ A simple `Hello, {User}` event.
15
15
Install from [NuGet](https://nuget.org/packages/Serilog.Formatting.Compact):
16
16
17
17
```powershell
18
-
Install-Package Serilog.Formatting.Compact -Pre
18
+
Install-Package Serilog.Formatting.Compact
19
19
```
20
20
21
-
The formatter is used in conjunction with sinks that accept `ITextFormatter`. For example, the [rolling file](https://github.com/serilog/serilog-sinks-rollingfile) sink:
21
+
The formatter is used in conjunction with sinks that accept `ITextFormatter`. For example, the [file](https://github.com/serilog/serilog-sinks-file) sink:
@@ -58,13 +86,13 @@ The format defines a handful of reified properties that have special meaning:
58
86
|`@l`| Level | An implementation-specific level identifier (string or number) | Absence implies "informational" |
59
87
|`@x`| Exception | A language-dependent error representation potentially including backtrace ||
60
88
|`@i`| Event id | An implementation specific event id (string or number) ||
61
-
|`@r`| Renderings | If `@mt` includes properties with programming-language-specific formatting, an array of pre-rendered values for each such property ||
89
+
|`@r`| Renderings | If `@mt` includes tokens with programming-language-specific formatting, an array of pre-rendered values for each such token | May be omitted; if present, the count of renderings must match the count of formatted tokens exactly|
62
90
63
91
The `@` sigil may be escaped at the start of a user property name by doubling, e.g. `@@name` denotes a property called `@name`.
64
92
65
93
##### Batch format
66
94
67
-
When events are batched into a single payload, a newline-delimited stream of JSON documents is required. Either `\n` or `\r\n` delimiters may be used.
95
+
When events are batched into a single payload, a newline-delimited stream of JSON documents is required. Either `\n` or `\r\n` delimiters may be used. Batches of newline-separated compact JSON events can use the (unofficial) MIME type `application/vnd.serilog.clef`.
68
96
69
97
##### Versioning
70
98
@@ -110,7 +138,16 @@ See `test/Serilog.Formatting.Compact.Tests/FormattingBenchmarks.cs`.
Several tools are available for working with the CLEF format.
149
+
150
+
***[`clef-tool`](https://github.com/datalust/clef-tool)** - a CLI application for processing CLEF files
151
+
***[Compact Log Format Viewer](https://github.com/warrenbuckley/Compact-Log-Format-Viewer)** - a cross-platform viewer for CLEF JSON files
152
+
***[_Serilog.Formatting.Compact.Reader_](https://github.com/serilog/serilog-formatting-compact-reader)** - convert CLEF JSON documents back into Serilog `LogEvent`s
0 commit comments