Update Program.cs to read Seq config from appsettings.json

This commit is contained in:
masoud
2025-12-05 21:53:03 +00:00
parent 74910c01aa
commit 6f7b1ab447
2 changed files with 101 additions and 2 deletions

View File

@@ -20,8 +20,8 @@ if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
var levelSwitch = new LoggingLevelSwitch();
var logger = new LoggerConfiguration()
.WriteTo.Seq("https://seq.afrino.co",
apiKey: "qPxY2VEQwMfWMI8IX4Fq",
.WriteTo.Seq(builder.Configuration["Seq:ServerUrl"] ?? "http://seq-svc:5341",
apiKey: string.IsNullOrEmpty(builder.Configuration["Seq:ApiKey"]) ? null : builder.Configuration["Seq:ApiKey"],
controlLevelSwitch: levelSwitch)
.CreateLogger();
builder.Logging.AddSerilog(logger);