Cysharp / ZLogger

Zero Allocation Text/Structured Logger for .NET with StringInterpolation and Source Generator, built on top of a Microsoft.Extensions.Logging.
MIT License
1.14k stars 80 forks source link

prototype flattening structured logs to eliminate payload object #63

Closed GabrielF00 closed 1 year ago

GabrielF00 commented 1 year ago
output of benchmark: Method Mean Error Gen 0 Gen 1 Allocated
SeriFile 2,888.7 ns NA 0.4272 - 896 B
ZFile 186.9 ns NA 0.0122 0.0043 77 B
ZFileWithPayload 251.5 ns NA 0.0205 0.0081 129 B
GabrielF00 commented 1 year ago

Sorry - I accidentally posted this to the base repo rather than the forked repo. This is an experiment I'm working on and was not intended to be shared externally. I'm experimenting with allowing users of the library to override the default behavior for Payload objects so that the content of the payload is written directly into the base level of the JSON object, not into a Payload object. This will help ingest ZLogger logs into Elasticsearch and other systems.