serilog / serilog-sinks-file

Write Serilog events to files in text and JSON formats, optionally rolling on time or size
Apache License 2.0
334 stars 117 forks source link

JSON destructuring and produced double quotes around property names #273

Closed MontyGvMC closed 1 year ago

MontyGvMC commented 1 year ago

I am sorry for reporting not exactly a bug since I need your opinion if this is a bug or a feature (I missed).

Regarding JSON destructuring in Serilog.Sinks.File 5.0.0.

Taking the sample from the Serilog website startpage:

var position = new { Latitude = 25, Longitude = 134 };
var elapsedMs = 34;

log.Information("Processed {@Position} in {Elapsed:000} ms.", position, elapsedMs);

it creates two different results

{"Position": {"Latitude": 25, "Longitude": 134}, "Elapsed": 34}

and

09:14:22 [Information] Processed { Latitude: 25, Longitude: 134 } in 034 ms.

The difference I am pointing out are the existing/missing double quotes around the property names Latitude and Longitude.

Is the existence of the double quotes configurable or is the different behaviour a bug?

A similar question of mine on Stackoverflow provides a different example.... StackOverflow Question 75255058

nblumhardt commented 1 year ago

Answered over there :+1: