1

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

Nicholas Blumhardt
  • 30,271
  • 4
  • 90
  • 101
John Livermore
  • 30,235
  • 44
  • 126
  • 216

1 Answers1

2

Serilog's ForContext() does this:

    var sensorInput = new { Latitude = 25, Longitude = 134 };
    Log.ForContext("Payload", sensorInput, true).Information("Processing some data");
Nicholas Blumhardt
  • 30,271
  • 4
  • 90
  • 101