using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Console;
public static void Main()
using var loggerFactory = LoggerFactory.Create(builder =>
builder.AddSimpleConsole(options =>
options.IncludeScopes = true;
options.SingleLine = true;
options.TimestampFormat = "hh:mm:ss ";
var logger = loggerFactory.CreateLogger<Program>();
string json = "{\"status\":\"success\",\"code\":200}";
using JsonDocument doc = JsonDocument.Parse(json);
logger.LogInformation("Logged with @ - {@doc}", doc);
logger.LogInformation("Logged with $ {$doc}", doc);
logger.LogInformation("Logged with doc.RootElement.ToString() {toString}", doc.RootElement.ToString());