Serilog - show object in details area, but not in summary message

356 Views Asked by At

Below is a sample trace as shown in Seq from Serilog. I would like the SensorInput to be in the details area, but not serialized as the message.

How can I have SensorInput show only in the details area?

        var sensorInput = new { Latitude = 25, Longitude = 134 };
        Log.Information("Processing {@Payload}", sensorInput);

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

Serilog's ForContext() does this:

    var sensorInput = new { Latitude = 25, Longitude = 134 };
    Log.ForContext("Payload", sensorInput, true).Information("Processing some data");