write error log to file

This commit is contained in:
Paddy Xu
2018-01-21 16:36:18 +02:00
parent 5667f98a01
commit 5c0f88a961
3 changed files with 21 additions and 14 deletions
+2 -7
View File
@@ -149,19 +149,14 @@ namespace QuickLook
private void CurrentPluginFailed(string path, ExceptionDispatchInfo e)
{
var plugin = _viewerWindow.Plugin.GetType();
_viewerWindow.BeginHide();
TrayIconManager.ShowNotification("", $"Failed to preview {Path.GetFileName(path)}", true);
Debug.WriteLine(e.SourceException.ToString());
Debug.WriteLine(e.SourceException.StackTrace);
const string source = "QuickLook Preview Error";
if (!EventLog.SourceExists(source))
EventLog.CreateEventSource(source, "Application");
EventLog.WriteEntry(source, e.SourceException.ToString(),
EventLogEntryType.Error);
ProcessHelper.WriteLog(e.SourceException.ToString());
if (plugin != PluginManager.GetInstance().DefaultPlugin.GetType())
BeginShowNewWindow(path, PluginManager.GetInstance().DefaultPlugin);