Skip to content

Free, open-source Windows optimization tool for performance, privacy, and simplicity.

Refine log level to align with message severity

itsfatduck8a33fb0c0655
diff --git a/optimizerDuck/src/Core/Helpers/RequirementChecker.cs b/optimizerDuck/src/Core/Helpers/RequirementChecker.cs
index dacaf97..7603a5f 100644
--- a/optimizerDuck/src/Core/Helpers/RequirementChecker.cs
+++ b/optimizerDuck/src/Core/Helpers/RequirementChecker.cs
@@ -1,11 +1,11 @@
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Security.Principal;
-using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging;
using optimizerDuck.Core.Services;
using optimizerDuck.UI;
using optimizerDuck.UI.Components;
using optimizerDuck.UI.Logger;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Security.Principal;
namespace optimizerDuck.Core.Helpers;
@@ -88,7 +88,7 @@ public static class RequirementChecker
}
};
Log.LogInformation("Restarting application with administrator privileges and maximized window.");
- Log.LogWarning(
+ Log.LogInformation(
$"Please press [{Theme.Success}]Yes[/] if [{Theme.Primary}]User Account Control[/] (UAC) prompt appears.");
process.Start();
diff --git a/optimizerDuck/src/Core/Helpers/SystemHelper.cs b/optimizerDuck/src/Core/Helpers/SystemHelper.cs
index b9aaead..88e905d 100644
--- a/optimizerDuck/src/Core/Helpers/SystemHelper.cs
+++ b/optimizerDuck/src/Core/Helpers/SystemHelper.cs
@@ -81,7 +81,7 @@ public static class SystemHelper
foreach (var path in paths)
{
var result = ShellService.PowerShell($"Add-MpPreference -ExclusionPath \"{path}\"");
- if (result.ExitCode != 0) Log.LogWarning($"[{Theme.Error}]Failed to add path to exclusions: {path}[/]");
+ if (result.ExitCode != 0) Log.LogError($"[{Theme.Error}]Failed to add path to exclusions: {path}[/]");
}
}
}
\ No newline at end of file
diff --git a/optimizerDuck/src/Core/Helpers/SystemProtectionHelper.cs b/optimizerDuck/src/Core/Helpers/SystemProtectionHelper.cs
index 067e495..528d334 100644
--- a/optimizerDuck/src/Core/Helpers/SystemProtectionHelper.cs
+++ b/optimizerDuck/src/Core/Helpers/SystemProtectionHelper.cs
@@ -18,7 +18,7 @@ public static class SystemProtectionHelper
var result = ShellService.PowerShell("Enable-ComputerRestore -Drive \"$env:SystemDrive\"");
if (result.ExitCode != 0)
{
- Log.LogWarning($"[{Theme.Error}]Failed to enable System Protection.[/]");
+ Log.LogError($"[{Theme.Error}]Failed to enable System Protection.[/]");
return PromptDialog.Warning("Failed to enable System Protection",
$"""
We were [{Theme.Error}]unable[/] to enable System Protection.
@@ -43,7 +43,7 @@ public static class SystemProtectionHelper
$"Checkpoint-Computer -Description \"{Defaults.RestorePointName}\" -RestorePointType MODIFY_SETTINGS");
if (result.ExitCode != 0)
{
- Log.LogWarning($"[{Theme.Error}]Failed to create restore point.[/]");
+ Log.LogError($"[{Theme.Error}]Failed to create restore point.[/]");
PromptDialog.Warning("Failed to create Restore Point",
$"""
We were [{Theme.Error}]unable[/] to create a restore point.
diff --git a/optimizerDuck/src/Core/Optimizers/GamingOptimizations.cs b/optimizerDuck/src/Core/Optimizers/GamingOptimizations.cs
index c3fb862..ea994df 100644
--- a/optimizerDuck/src/Core/Optimizers/GamingOptimizations.cs
+++ b/optimizerDuck/src/Core/Optimizers/GamingOptimizations.cs
@@ -82,14 +82,14 @@ public class GamingOptimizations : IOptimizationGroup
{
if (string.IsNullOrWhiteSpace(gpu.DeviceId))
{
- Log.LogWarning("Skipping GPU with no Device ID: {GpuName} (Device ID: {DeviceId})", gpu.Name,
+ Log.LogError("Skipping GPU with no Device ID: {GpuName} (Device ID: {DeviceId})", gpu.Name,
gpu.DeviceId ?? "null");
continue;
}
if (!TryParseDeviceIdToIndex(gpu.DeviceId, out var index))
{
- Log.LogWarning("Skipping GPU with invalid Device ID: {GpuName} (Device ID: {DeviceId})", gpu.Name,
+ Log.LogError("Skipping GPU with invalid Device ID: {GpuName} (Device ID: {DeviceId})", gpu.Name,
gpu.DeviceId ?? "null");
continue;
}
@@ -137,7 +137,7 @@ public class GamingOptimizations : IOptimizationGroup
break;
case GpuVendor.Unknown:
default:
- Log.LogWarning("Unsupported GPU vendor: {GpuVendor} for {GpuName} at index {GpuIndex:D4}.",
+ Log.LogError("Unsupported GPU vendor: {GpuVendor} for {GpuName} at index {GpuIndex:D4}.",
gpu.Vendor, gpu.Name, index);
break;
}
diff --git a/optimizerDuck/src/Core/Services/RegistryService.cs b/optimizerDuck/src/Core/Services/RegistryService.cs
index 8f82353..8fdd09c 100644
--- a/optimizerDuck/src/Core/Services/RegistryService.cs
+++ b/optimizerDuck/src/Core/Services/RegistryService.cs
@@ -1,8 +1,8 @@
-using System.Diagnostics.CodeAnalysis;
-using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging;
using Microsoft.Win32;
using optimizerDuck.Models;
using optimizerDuck.UI.Logger;
+using System.Diagnostics.CodeAnalysis;
namespace optimizerDuck.Core.Services;
@@ -42,7 +42,7 @@ public static class RegistryService
if (string.IsNullOrWhiteSpace(fullPath))
{
- ServiceTracker.Current?.Log.LogWarning("Registry path is null or empty");
+ ServiceTracker.Current?.Log.LogError("Registry path is null or empty");
ServiceTracker.Current?.Track(nameof(RegistryService), false);
return false;
}
@@ -53,7 +53,7 @@ public static class RegistryService
if (!RootKeysMap.TryGetValue(rootToken, out rootKey))
{
- ServiceTracker.Current?.Log.LogWarning("Unknown root key: {RootToken}", rootToken);
+ ServiceTracker.Current?.Log.LogError("Unknown root key: {RootToken}", rootToken);
ServiceTracker.Current?.Track(nameof(RegistryService), false);
return false;
}
@@ -95,7 +95,7 @@ public static class RegistryService
return true;
}
- ServiceTracker.Current?.Log.LogWarning("SubKey not found: {Root}\\{SubPath}", rootKey.Name, subPath);
+ ServiceTracker.Current?.Log.LogError("SubKey not found: {Root}\\{SubPath}", rootKey.Name, subPath);
ServiceTracker.Current?.Track(nameof(RegistryService), false);
return false;
}
diff --git a/optimizerDuck/src/Core/Services/ServiceProcessService.cs b/optimizerDuck/src/Core/Services/ServiceProcessService.cs
index b8f8413..f4cc3bb 100644
--- a/optimizerDuck/src/Core/Services/ServiceProcessService.cs
+++ b/optimizerDuck/src/Core/Services/ServiceProcessService.cs
@@ -1,7 +1,7 @@
-using System.Management;
-using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging;
using optimizerDuck.Models;
using optimizerDuck.UI.Logger;
+using System.Management;
namespace optimizerDuck.Core.Services;
@@ -22,7 +22,7 @@ public static class ServiceProcessService
if (service == null)
{
- ServiceTracker.Current?.Log.LogWarning("Service '{ServiceName}' not found.", item.ServiceName);
+ ServiceTracker.Current?.Log.LogError("Service '{ServiceName}' not found.", item.ServiceName);
ServiceTracker.Current?.Track(nameof(ChangeServiceStartupType), false);
return false;
}
@@ -50,7 +50,7 @@ public static class ServiceProcessService
return result;
}
- ServiceTracker.Current?.Log.LogWarning(
+ ServiceTracker.Current?.Log.LogError(
"Failed to change startup type for '{ServiceName}'. ReturnValue: {Result}", item.ServiceName,
resultCode);
ServiceTracker.Current?.Track(nameof(ChangeServiceStartupType), false);