11using CommunityToolkit . Mvvm . DependencyInjection ;
22using CommunityToolkit . Mvvm . Input ;
33using CommunityToolkit . Mvvm . Messaging ;
4+ using Microsoft . Extensions . Logging ;
45using OwlCore . AbstractUI . Models ;
56using OwlCore . ComponentModel ;
7+ using System ;
68using System . Net . NetworkInformation ;
79using System . Threading . Tasks ;
810using System . Windows ;
@@ -21,10 +23,12 @@ public partial class ModsPage : UserControl
2123 private const string MOD_MANAGER_TITLE = "MOD MANAGER" ;
2224
2325 private readonly Settings _settings ;
26+ private readonly ILogger < ModsPage > _log ;
2427
25- public ModsPage ( Settings settings )
28+ public ModsPage ( Settings settings , ILogger < ModsPage > log )
2629 {
2730 _settings = settings ;
31+ _log = log ;
2832
2933 InitializeComponent ( ) ;
3034 ModList . ItemsSource = ModManager . ModFactories ;
@@ -84,6 +88,8 @@ private async void ApplyButton_Click(object sender, RoutedEventArgs e)
8488 Description = $ "Successfully applied '{ modTitle } '",
8589 OnAction = new AsyncRelayCommand < bool > ( ShowDonationRequestDialog )
8690 } ) ) ;
91+
92+ _log . LogInformation ( "Mod {ModId} applied" , mod . Metadata . Id ) ;
8793 }
8894
8995 private async void ResetButton_Click ( object sender , RoutedEventArgs e )
@@ -130,6 +136,8 @@ private async void ResetButton_Click(object sender, RoutedEventArgs e)
130136 Title = MOD_MANAGER_TITLE ,
131137 Description = $ "Successfully reset '{ modTitle } '",
132138 } ) ) ;
139+
140+ _log . LogError ( "Mod {ModId} reset" , mod . Metadata . Id ) ;
133141 }
134142
135143 private static bool TryGetModFromControl ( object sender , out IModFactory < Mod > modFactory )
@@ -148,8 +156,10 @@ private static async Task<Mod> CreateModInstance(IModFactory<Mod> modFactory)
148156 return mod ;
149157 }
150158
151- private static void ShowErrorDialog ( Mod mod , string action , string errorMessage )
159+ private void ShowErrorDialog ( Mod mod , string action , string errorMessage )
152160 {
161+ _log . LogError ( "Mod {ModId} failed to {Action}: {ErrorMessage}" , mod . Metadata . Id , action , errorMessage ) ;
162+
153163 DialogViewModel errorDialog = new ( )
154164 {
155165 Title = MOD_MANAGER_TITLE ,
0 commit comments