feat(logging): route Worker logging through shared LoggingSetup

This commit is contained in:
mika kuns
2026-06-04 19:13:51 +02:00
parent 7ce418d474
commit c592ca32fb
2 changed files with 3 additions and 7 deletions

View File

@@ -2,6 +2,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\ClaudeDo.Data\ClaudeDo.Data.csproj" /> <ProjectReference Include="..\ClaudeDo.Data\ClaudeDo.Data.csproj" />
<ProjectReference Include="..\ClaudeDo.Logging\ClaudeDo.Logging.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -31,13 +31,8 @@ var builder = WebApplication.CreateBuilder(args);
var logRoot = cfg.LogRoot; var logRoot = cfg.LogRoot;
Directory.CreateDirectory(logRoot); Directory.CreateDirectory(logRoot);
builder.Host.UseSerilog((ctx, lc) => lc builder.Host.UseSerilog((ctx, lc) =>
.MinimumLevel.Information() ClaudeDo.Logging.LoggingSetup.Configure(lc, "worker", logRoot));
.WriteTo.File(
System.IO.Path.Combine(logRoot, "worker-.log"),
rollingInterval: RollingInterval.Day,
retainedFileCountLimit: 7,
shared: true));
builder.Services.AddDbContextFactory<ClaudeDoDbContext>(opt => builder.Services.AddDbContextFactory<ClaudeDoDbContext>(opt =>
opt.UseSqlite($"Data Source={cfg.DbPath}")); opt.UseSqlite($"Data Source={cfg.DbPath}"));