I would like to log any json into serilog properties. I have read a lot about serilog and json, but it is a structured json logging, with a message template. So instead of logging this Log.Info("{@text}",text);
I would like to do this:
var json = "{ \"text\": \"hello\" }"; //a json string or a Json object
Log.Info(json);
The main difference is that with the first approach, you have a message template and always you have a "text" property. I would like to have json with different structures, for example if then I have:
var json = "{ \"text\": \"hello\", \"text2\": \"hello2\" }"; //a json string or a Json object
Log.Info(json);
I would like to obtain 2 properties, that is, 1 property for each json property, without having to define a message Template. Is this possible? do I have to implement my own JsonFormatter?
JObject
? If so, github.com/destructurama/json-net should be what you're after. – Measly