From 8d6d26c9d2f8218d2be0c884de9706f4ed02f0b1 Mon Sep 17 00:00:00 2001 From: Michael Bucari-Tovo Date: Sun, 15 May 2022 11:16:41 -0600 Subject: [PATCH] Improve logging --- Source/LibationWinForms/ProcessQueue/ProcessBook.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/LibationWinForms/ProcessQueue/ProcessBook.cs b/Source/LibationWinForms/ProcessQueue/ProcessBook.cs index ea0e14d5..75cb21e9 100644 --- a/Source/LibationWinForms/ProcessQueue/ProcessBook.cs +++ b/Source/LibationWinForms/ProcessQueue/ProcessBook.cs @@ -96,6 +96,7 @@ namespace LibationWinForms.ProcessQueue public async Task ProcessOneAsync() { + string procName = CurrentProcessable.Name; try { LinkProcessable(CurrentProcessable); @@ -106,21 +107,21 @@ namespace LibationWinForms.ProcessQueue return Result = ProcessBookResult.Success; else if (statusHandler.Errors.Contains("Cancelled")) { - Logger.Info($"{CurrentProcessable.Name}: Process was cancelled {LibraryBook.Book}"); + Logger.Info($"{procName}: Process was cancelled {LibraryBook.Book}"); return Result = ProcessBookResult.Cancelled; } else if (statusHandler.Errors.Contains("Validation failed")) { - Logger.Info($"{CurrentProcessable.Name}: Validation failed {LibraryBook.Book}"); + Logger.Info($"{procName}: Validation failed {LibraryBook.Book}"); return Result = ProcessBookResult.ValidationFail; } foreach (var errorMessage in statusHandler.Errors) - Logger.Error($"{CurrentProcessable.Name}: {errorMessage}"); + Logger.Error($"{procName}: {errorMessage}"); } catch (Exception ex) { - Logger.Error(ex, CurrentProcessable.Name); + Logger.Error(ex, procName); } finally {