More useful logging

This commit is contained in:
Michael Bucari-Tovo 2022-05-15 09:58:36 -06:00
parent 0a6a78bc58
commit a46041c958

View File

@ -49,8 +49,8 @@ namespace LibationWinForms.ProcessQueue
private TimeSpan _timeRemaining; private TimeSpan _timeRemaining;
private Image _cover; private Image _cover;
public ProcessBookResult Result { get => _result; private set { _result = value; NotifyPropertyChanged(); } } public ProcessBookResult Result { get => _result; private set { _result = value; NotifyPropertyChanged(); } }
public ProcessBookStatus Status { get => _status; private set { _status = value; NotifyPropertyChanged(); } } public ProcessBookStatus Status { get => _status; private set { _status = value; NotifyPropertyChanged(); } }
public string BookText { get => _bookText; private set { _bookText = value; NotifyPropertyChanged(); } } public string BookText { get => _bookText; private set { _bookText = value; NotifyPropertyChanged(); } }
public int Progress { get => _progress; private set { _progress = value; NotifyPropertyChanged(); } } public int Progress { get => _progress; private set { _progress = value; NotifyPropertyChanged(); } }
public TimeSpan TimeRemaining { get => _timeRemaining; private set { _timeRemaining = value; NotifyPropertyChanged(); } } public TimeSpan TimeRemaining { get => _timeRemaining; private set { _timeRemaining = value; NotifyPropertyChanged(); } }
@ -106,21 +106,21 @@ namespace LibationWinForms.ProcessQueue
return Result = ProcessBookResult.Success; return Result = ProcessBookResult.Success;
else if (statusHandler.Errors.Contains("Cancelled")) else if (statusHandler.Errors.Contains("Cancelled"))
{ {
Logger.Info($"Process was cancelled {LibraryBook.Book}"); Logger.Info($"{CurrentProcessable.Name}: Process was cancelled {LibraryBook.Book}");
return Result = ProcessBookResult.Cancelled; return Result = ProcessBookResult.Cancelled;
} }
else if (statusHandler.Errors.Contains("Validation failed")) else if (statusHandler.Errors.Contains("Validation failed"))
{ {
Logger.Info($"Validation failed {LibraryBook.Book}"); Logger.Info($"{CurrentProcessable.Name}: Validation failed {LibraryBook.Book}");
return Result = ProcessBookResult.ValidationFail; return Result = ProcessBookResult.ValidationFail;
} }
foreach (var errorMessage in statusHandler.Errors) foreach (var errorMessage in statusHandler.Errors)
Logger.Error(errorMessage); Logger.Error($"{CurrentProcessable.Name}: {errorMessage}");
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.Error(ex); Logger.Error(ex, CurrentProcessable.Name);
} }
finally finally
{ {
@ -151,7 +151,7 @@ namespace LibationWinForms.ProcessQueue
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.Error(ex, "Error while cancelling"); Logger.Error(ex, $"{CurrentProcessable.Name}: Error while cancelling");
} }
} }