feat(logging): wire App/Ui logging to shared LoggingSetup

This commit is contained in:
mika kuns
2026-06-04 19:15:36 +02:00
parent c592ca32fb
commit 324f1d9c7c
2 changed files with 10 additions and 0 deletions

View File

@@ -24,10 +24,12 @@
</PackageReference> </PackageReference>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.1" /> <PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\ClaudeDo.Ui\ClaudeDo.Ui.csproj" /> <ProjectReference Include="..\ClaudeDo.Ui\ClaudeDo.Ui.csproj" />
<ProjectReference Include="..\ClaudeDo.Logging\ClaudeDo.Logging.csproj" />
<ProjectReference Include="..\ClaudeDo.Localization\ClaudeDo.Localization.csproj" /> <ProjectReference Include="..\ClaudeDo.Localization\ClaudeDo.Localization.csproj" />
</ItemGroup> </ItemGroup>
<Import Project="..\ClaudeDo.Localization\Locales.targets" /> <Import Project="..\ClaudeDo.Localization\Locales.targets" />

View File

@@ -13,6 +13,8 @@ using ClaudeDo.Ui.ViewModels.Modals;
using ClaudeDo.Ui.ViewModels.Modals.Settings; using ClaudeDo.Ui.ViewModels.Modals.Settings;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Serilog;
using System; using System;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
@@ -77,6 +79,12 @@ sealed class Program
var sc = new ServiceCollection(); var sc = new ServiceCollection();
var logRoot = Path.Combine(Path.GetDirectoryName(dbPath)!, "logs");
var serilogLogger = ClaudeDo.Logging.LoggingSetup
.Configure(new LoggerConfiguration(), "app", logRoot)
.CreateLogger();
sc.AddLogging(b => b.AddSerilog(serilogLogger, dispose: true));
// Infrastructure // Infrastructure
sc.AddSingleton(settings); sc.AddSingleton(settings);
var localesDir = Path.Combine(AppContext.BaseDirectory, "locales"); var localesDir = Path.Combine(AppContext.BaseDirectory, "locales");