Improve logging for PT Run (#6800)

* init code pass

* adjusting tabbing for readabilty

* few small adjustments
This commit is contained in:
Clint Rutkas
2020-09-23 16:32:06 -07:00
committed by GitHub
parent dafc1e0c7d
commit b071220b6c
35 changed files with 186 additions and 289 deletions

View File

@@ -82,8 +82,9 @@ namespace PowerLauncher
bootTime.Start();
Stopwatch.Normal("|App.OnStartup|Startup cost", () =>
{
Log.Info("|App.OnStartup|Begin PowerToys Run startup ----------------------------------------------------");
Log.Info($"|App.OnStartup|Runtime info:{ErrorReporting.RuntimeInfo()}");
Log.Info("Begin PowerToys Run startup ----------------------------------------------------", GetType());
Log.Info($"Runtime info:{ErrorReporting.RuntimeInfo()}", GetType());
RegisterAppDomainExceptions();
RegisterDispatcherUnhandledException();
@@ -118,7 +119,7 @@ namespace PowerLauncher
_mainVM.MainWindowVisibility = Visibility.Visible;
_mainVM.ColdStartFix();
_themeManager.ThemeChanged += OnThemeChanged;
Log.Info("|App.OnStartup|End PowerToys Run startup ---------------------------------------------------- ");
Log.Info("End PowerToys Run startup ---------------------------------------------------- ", GetType());
bootTime.Stop();
@@ -178,7 +179,7 @@ namespace PowerLauncher
{
Stopwatch.Normal("|App.OnExit|Exit cost", () =>
{
Log.Info("|App.OnExit| Start PowerToys Run Exit---------------------------------------------------- ");
Log.Info("Start PowerToys Run Exit---------------------------------------------------- ", GetType());
if (disposing)
{
if (_themeManager != null)
@@ -198,7 +199,7 @@ namespace PowerLauncher
// TODO: free unmanaged resources (unmanaged objects) and override finalizer
// TODO: set large fields to null
_disposed = true;
Log.Info("|App.OnExit| End PowerToys Run Exit ---------------------------------------------------- ");
Log.Info("End PowerToys Run Exit ---------------------------------------------------- ", GetType());
});
}
}

View File

@@ -313,7 +313,7 @@ namespace PowerLauncher
// Hence, there can be a situation where the element index that we want to scroll into view is out of range for it's parent control.
// To mitigate this we use the UpdateLayout function, which forces layout update to ensure that the parent element contains the latest properties.
// However, it has a performance impact and is therefore not called each time.
Log.Exception("MainWindow", "The parent element layout is not updated yet", ex, "SuggestionsList_SelectionChanged");
Log.Exception("The parent element layout is not updated yet", ex, GetType());
listview.UpdateLayout();
listview.ScrollIntoView(e.AddedItems[0]);
}

View File

@@ -44,7 +44,7 @@ namespace PowerLauncher
{
if (!_settingsUtils.SettingsExists(PowerLauncherSettings.ModuleName))
{
Log.Info("|SettingsWatcher.OverloadSettings|PT Run settings.json was missing, creating a new one");
Log.Info("PT Run settings.json was missing, creating a new one", GetType());
var defaultSettings = new PowerLauncherSettings();
defaultSettings.Save(_settingsUtils);
@@ -110,7 +110,7 @@ namespace PowerLauncher
if (retryCount > MaxRetries)
{
retry = false;
Log.Exception($"|SettingsWatcher.OverloadSettings| Failed to Deserialize PowerToys settings, Retrying {e.Message}", e);
Log.Exception($"Failed to Deserialize PowerToys settings, Retrying {e.Message}", e, GetType());
}
else
{
@@ -122,7 +122,7 @@ namespace PowerLauncher
if (retryCount > MaxRetries)
{
retry = false;
Log.Exception($"|SettingsWatcher.OverloadSettings| Failed to Deserialize PowerToys settings, Creating new settings as file could be corrupted {e.Message}", e);
Log.Exception($"Failed to Deserialize PowerToys settings, Creating new settings as file could be corrupted {e.Message}", e, GetType());
// Settings.json could possibly be corrupted. To mitigate this we delete the
// current file and replace it with a correct json value.

View File

@@ -189,7 +189,7 @@ namespace PowerLauncher.ViewModel
catch (Exception e)
#pragma warning restore CA1031 // Do not catch general exception types
{
Log.Exception($"|ResultViewModel.Image|IcoPath is empty and exception when calling Icon() for result <{Result.Title}> of plugin <{Result.PluginDirectory}>", e);
Log.Exception($"IcoPath is empty and exception when calling Icon() for result <{Result.Title}> of plugin <{Result.PluginDirectory}>", e, GetType());
imagePath = ImageLoader.ErrorIconPath;
}
}