Skip to content

Commit

Permalink
general: added last log entry to the unauthorized error dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
stojy committed Apr 30, 2023
1 parent 510e390 commit a317f39
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions ClrVpin/Cleaner/CleanerViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ private async void Start()
{
progress?.Close();
Logger.Error(e, "Cleaner");
await Notification.ShowWarning(HomeWindow.HomeDialogHost, "Cleaner Was Unsuccessful", "Please check that the folder is not read only and then try again.",
$"Error: {e.Message}\nDetails: refer to the log file.. ClrVpin.log");
await Notification.ShowWarning(HomeWindow.HomeDialogHost, "Cleaner Was Unsuccessful", "Access Error: please check that the folder is not read only and then try again.",
$"{Logger.GetLogs(1)}", showCloseButton:true);
_window.Close();
}

Expand Down
7 changes: 5 additions & 2 deletions ClrVpin/Logging/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,12 @@ private static string GetLogFile()
return path;
}

private static void Add(Level level, string message)
private static void Add(Level level, string message, bool sync = false)
{
_dispatch.BeginInvoke(() => Logs.Add(new Log(level, message)));
if (!sync)
_dispatch.BeginInvoke(() => Logs.Add(new Log(level, message)));
else
_dispatch.Invoke(() => Logs.Add(new Log(level, message)));
}

private static readonly ILogger _logger = LogManager.GetCurrentClassLogger();
Expand Down
4 changes: 2 additions & 2 deletions ClrVpin/Merger/MergerViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ private async void Start()
{
progress?.Close();
Logger.Error(e, "Merger");
await Notification.ShowWarning(HomeWindow.HomeDialogHost, "Merger Was Unsuccessful", "Please check that the folder is not read only and then try again.",
$"Error: {e.Message}\nDetails: refer to the log file.. ClrVpin.log");
await Notification.ShowWarning(HomeWindow.HomeDialogHost, "Merger Was Unsuccessful", "Access Error: please check that the folder is not read only and then try again.",
$"{Logger.GetLogs(1)}", showCloseButton:true);
_window.Close();
}

Expand Down

0 comments on commit a317f39

Please sign in to comment.