Registers Serilog via SVSim.Hosting.UseSvSimSerilog("svsim-api") right
after CreateBuilder and wraps Main in try/catch/finally so a fatal
startup exception logs before CloseAndFlush.
Also updates the SVSim.Hosting extension to gate the file sink on entry
assembly rather than the ASP.NET environment name. WebApplicationFactory
sets the environment via a hook that resolves after both CreateBuilder
and the UseSerilog callback see their environment view, so
IsEnvironment("Testing") is unreliable in tests. The entry assembly
under `dotnet test` is always "testhost", which is a reliable signal.
appsettings.json grows a Serilog section mirroring the existing
Logging:LogLevel overrides; the Logging block itself is left in place
per the spec's follow-up cleanup note.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
32 lines
981 B
JSON
32 lines
981 B
JSON
{
|
|
"Logging": {
|
|
"LogLevel": {
|
|
"Default": "Information",
|
|
"Microsoft.AspNetCore": "Warning",
|
|
"Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware": "Information",
|
|
"Microsoft.EntityFrameworkCore": "Warning",
|
|
"Microsoft.EntityFrameworkCore.Database.Command": "Warning",
|
|
"Microsoft.EntityFrameworkCore.Infrastructure": "Warning"
|
|
}
|
|
},
|
|
"Serilog": {
|
|
"MinimumLevel": {
|
|
"Default": "Information",
|
|
"Override": {
|
|
"Microsoft.AspNetCore": "Warning",
|
|
"Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware": "Information",
|
|
"Microsoft.EntityFrameworkCore": "Warning",
|
|
"Microsoft.EntityFrameworkCore.Database.Command": "Warning",
|
|
"Microsoft.EntityFrameworkCore.Infrastructure": "Warning"
|
|
}
|
|
}
|
|
},
|
|
"ConnectionStrings": {
|
|
"ApplicationDb": "Host=localhost;Database=svsim;Username=postgres;password=postgres"
|
|
},
|
|
"Deck": {
|
|
"MaxDeckSlots": 36
|
|
},
|
|
"AllowedHosts": "*"
|
|
}
|