using System.Collections.Generic;
using Microsoft.Extensions.Logging;
using Serilog.Formatting.Compact;
public static void Main()
Console.WriteLine("Start");
Log.Logger = new LoggerConfiguration()
.WriteTo.Console(new CompactJsonFormatter())
using (var factory = LoggerFactory.Create(cfg => cfg.AddSerilog()))
var logger = factory.CreateLogger("DefaultLogger");
var properties = new Dictionary<string, object>();
properties.Add("foo", "bar");
using var scope = logger.BeginScope(properties);
logger.LogInformation("Behold the first log event!");
using var anotherScope = logger.BeginScope("This is {a}", "value-of-a");
logger.LogInformation("Behold the second log event!");
Console.WriteLine("Exit");