SEBWIN-835: Implemented further logging for power supply threshold issue.

This commit is contained in:
Damian Büchel 2024-01-17 11:08:03 +01:00
parent c52c461dbf
commit c9db98159d
2 changed files with 19 additions and 7 deletions

View file

@ -16,8 +16,8 @@ namespace SafeExamBrowser.Client.Operations
{
internal class ConfigurationOperation : ClientOperation
{
private ILogger logger;
private IRuntimeProxy runtime;
private readonly ILogger logger;
private readonly IRuntimeProxy runtime;
public override event ActionRequiredEventHandler ActionRequired { add { } remove { } }
public override event StatusChangedEventHandler StatusChanged;
@ -45,6 +45,8 @@ namespace SafeExamBrowser.Client.Operations
logger.Info($" -> Runtime-ID: {Context.AppConfig.RuntimeId}");
logger.Info($" -> Session-ID: {Context.SessionId}");
logger.Warn($"Power Supply Thresholds: Low = {configuration.Settings.PowerSupply.ChargeThresholdLow}, Critical = {configuration.Settings.PowerSupply.ChargeThresholdCritical}.");
return OperationResult.Success;
}

View file

@ -119,13 +119,17 @@ namespace SafeExamBrowser.Configuration
public LoadStatus TryLoadSettings(Uri resource, out AppSettings settings, PasswordParameters password = null)
{
var status = default(LoadStatus);
settings = LoadDefaultSettings();
logger.Info($"Initialized default settings, now attempting to load '{resource}'...");
logger.Warn($"Power Supply Thresholds: Low = {settings.PowerSupply.ChargeThresholdLow}, Critical = {settings.PowerSupply.ChargeThresholdCritical}.");
try
{
var status = TryLoadData(resource, out var stream);
status = TryLoadData(resource, out var stream);
using (stream)
{
@ -133,22 +137,28 @@ namespace SafeExamBrowser.Configuration
{
status = TryParseData(stream, out _, out _, out var data, password);
data.TryGetValue(Keys.UserInterface.SystemControls.PowerSupply.ChargeThresholdCritical, out var critical);
data.TryGetValue(Keys.UserInterface.SystemControls.PowerSupply.ChargeThresholdLow, out var low);
logger.Warn($"Power Supply Thresholds: Low (raw) = {low}, Critical (raw) = {critical}.");
if (status == LoadStatus.Success)
{
dataMapper.MapRawDataToSettings(data, settings);
dataProcessor.Process(data, settings);
}
}
return status;
}
}
catch (Exception e)
{
status = LoadStatus.UnexpectedError;
logger.Error($"Unexpected error while trying to load '{resource}'!", e);
return LoadStatus.UnexpectedError;
}
logger.Warn($"Power Supply Thresholds: Low = {settings.PowerSupply.ChargeThresholdLow}, Critical = {settings.PowerSupply.ChargeThresholdCritical}.");
return status;
}
private EncryptionParameters DetermineEncryptionForClientConfiguration(IDictionary<string, object> data, EncryptionParameters encryption)