SEBWIN-835: Added debugging logs for power supply thresholds.

This commit is contained in:
Damian Büchel 2024-01-16 18:01:18 +01:00
parent cecfe095a7
commit c52c461dbf

View file

@ -22,10 +22,10 @@ namespace SafeExamBrowser.SystemComponents.PowerSupply
private readonly ILogger logger;
private readonly PowerSupplySettings settings;
private DateTime lastStatusLog;
private Timer timer;
private double critical;
private double low;
private DateTime lastStatusLog;
private Timer timer;
public event StatusChangedEventHandler StatusChanged;
@ -53,6 +53,8 @@ namespace SafeExamBrowser.SystemComponents.PowerSupply
lastStatusLog = DateTime.Now;
}
logger.Warn($"Raw Charge: {charge}, Low Threshold: {low}, Critical Threshold: {critical}, Status: {status.BatteryChargeStatus}");
return status;
}
@ -60,9 +62,13 @@ namespace SafeExamBrowser.SystemComponents.PowerSupply
{
const int TWO_SECONDS = 2000;
logger.Warn($"Pre-Sanitized Low Threshold: {settings.ChargeThresholdLow}, Pre-Sanitized Critical Threshold: {settings.ChargeThresholdCritical}");
critical = SanitizeThreshold(settings.ChargeThresholdCritical);
low = SanitizeThreshold(settings.ChargeThresholdLow);
logger.Warn($"Sanitized Low Threshold: {low}, Sanitized Critical Threshold: {critical}");
timer = new Timer(TWO_SECONDS);
timer.Elapsed += Timer_Elapsed;
timer.AutoReset = true;