From 89d750fbe681a7cd92bd6442c535721f7939d251 Mon Sep 17 00:00:00 2001 From: Chris Kaczor Date: Tue, 27 Jan 2026 20:30:48 -0500 Subject: [PATCH] Add some logging and handle update error --- Service/HardwareMonitorService.cs | 9 +++++++++ StatusWindow/WindowSource.cs | 2 ++ 2 files changed, 11 insertions(+) diff --git a/Service/HardwareMonitorService.cs b/Service/HardwareMonitorService.cs index 6467176..6c2d3b1 100644 --- a/Service/HardwareMonitorService.cs +++ b/Service/HardwareMonitorService.cs @@ -1,4 +1,5 @@ using LibreHardwareMonitor.Hardware; +using Serilog; namespace HardwareMonitorStatusWindow.Service; @@ -12,6 +13,8 @@ public class HardwareMonitorService : IHardwareMonitorService static HardwareMonitorService() { + Log.Information("Creating computer"); + Computer = new Computer { IsCpuEnabled = true, @@ -25,6 +28,8 @@ public class HardwareMonitorService : IHardwareMonitorService IsPsuEnabled = true }; + Log.Information("Opening computer"); + Computer.Open(); HardwareUpdateVisitor = new HardwareUpdateVisitor(); @@ -32,8 +37,12 @@ public class HardwareMonitorService : IHardwareMonitorService public IEnumerable GetHardware() { + Log.Information("Updating computer"); + Computer.Accept(HardwareUpdateVisitor); + Log.Information("Creating hardware entries"); + var hardwareEntries = Computer.Hardware.Select(Hardware.Create); return hardwareEntries; diff --git a/StatusWindow/WindowSource.cs b/StatusWindow/WindowSource.cs index ddb42fa..c8cbbd9 100644 --- a/StatusWindow/WindowSource.cs +++ b/StatusWindow/WindowSource.cs @@ -120,6 +120,8 @@ internal class WindowSource : IWindowSource, IDisposable catch (Exception e) { Log.Error(e, nameof(UpdateApp)); + + return false; } return true;