datalust / seq-extensions-logging

Add centralized log collection to ASP.NET Core apps with one line of code.
https://datalust.co/seq
Apache License 2.0
84 stars 12 forks source link

Introduce `JsonSafeString` #51

Closed nblumhardt closed 1 year ago

nblumhardt commented 1 year ago

Fixes #46

Since no serialization actually occurs, the PR proposes to do this without relying on the @ operator that the original ticket describes.

JsonSafeString can be passed anywhere that property values are accepted (including through BeginScope()).

Usage

var json = "{\"A\": 42}";
_logger.LogInformation("The answer is {Answer}", new JsonSafeString(json));

Result

image