Reputation: 3979
I have code like this
var log = new LoggerConfiguration()
.MinimumLevel.Debug()
.Enrich.WithExceptionDetails()
.WriteTo.RollingFile(new JsonFormatter(renderMessage: true),"log-{Date}.txt")
.CreateLogger();
Is it possible to format the Json result as Indented ?
Upvotes: 5
Views: 2567
Reputation: 31832
No; the JSON formatter's goal is to produce newline-delimited JSON streams for consumption by other programs - human readability isn't a primary consideration.
You can, however, pipe these through something like jq
to pretty-print it:
cat log-20170420.txt | jq '.'
(chocolatey install jq
or sudo apt-get install jq
depending on your OS.)
Upvotes: 1