mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 09:46:54 +02:00
Add log for cmd pal ext to trace exceptions (#39326)
* Add log to trace error for apps. * Add bookmark log * registry exception log * fix * Added logger for cmdpal extensions. Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com> * remove noise * Update Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com> * change log level * change level * Fix comments * Fixed comments. Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com> * Resolve comments Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com> --------- Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com> Co-authored-by: Shawn Yuan <shuaiyuan@microsoft.com>
This commit is contained in:
@@ -9,6 +9,7 @@ using System.Linq;
|
||||
using System.Resources;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ManagedCommon;
|
||||
using Microsoft.CmdPal.Ext.WindowsTerminal.Helpers;
|
||||
using Microsoft.CmdPal.Ext.WindowsTerminal.Properties;
|
||||
using Microsoft.CommandPalette.Extensions;
|
||||
@@ -60,6 +61,7 @@ internal sealed partial class LaunchProfileAsAdminCommand : InvokableCommand
|
||||
//var message = Resources.run_terminal_failed;
|
||||
//Log.Exception("Failed to open Windows Terminal", ex, GetType());
|
||||
//_context.API.ShowMsg(name, message, string.Empty);
|
||||
Logger.LogError($"Failed to open Windows Terminal: {ex.Message}");
|
||||
}
|
||||
}
|
||||
#pragma warning restore IDE0059, CS0168, SA1005
|
||||
@@ -81,6 +83,7 @@ internal sealed partial class LaunchProfileAsAdminCommand : InvokableCommand
|
||||
// var message = Resources.run_terminal_failed;
|
||||
// Log.Exception("Failed to open Windows Terminal", ex, GetType());
|
||||
// _context.API.ShowMsg(name, message, string.Empty);
|
||||
Logger.LogError($"Failed to open Windows Terminal: {ex.Message}");
|
||||
}
|
||||
}
|
||||
#pragma warning restore IDE0059, CS0168
|
||||
@@ -94,6 +97,7 @@ internal sealed partial class LaunchProfileAsAdminCommand : InvokableCommand
|
||||
catch
|
||||
{
|
||||
// TODO GH #108 We need to figure out some logging
|
||||
// No need to log here, as the exception is already logged in LaunchElevated
|
||||
}
|
||||
|
||||
return CommandResult.Dismiss();
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.Linq;
|
||||
using System.Resources;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ManagedCommon;
|
||||
using Microsoft.CmdPal.Ext.WindowsTerminal.Helpers;
|
||||
using Microsoft.CmdPal.Ext.WindowsTerminal.Properties;
|
||||
using Microsoft.CommandPalette.Extensions;
|
||||
@@ -52,6 +53,7 @@ internal sealed partial class LaunchProfileCommand : InvokableCommand
|
||||
// var message = Resources.run_terminal_failed;
|
||||
// Log.Exception("Failed to open Windows Terminal", ex, GetType());
|
||||
// _context.API.ShowMsg(name, message, string.Empty);
|
||||
Logger.LogError($"Failed to open Windows Terminal: {ex.Message}");
|
||||
}
|
||||
}
|
||||
#pragma warning restore IDE0059, CS0168
|
||||
@@ -65,6 +67,7 @@ internal sealed partial class LaunchProfileCommand : InvokableCommand
|
||||
catch
|
||||
{
|
||||
// TODO GH #108 We need to figure out some logging
|
||||
// No need to log here, as the exception is already logged in the Launch method
|
||||
}
|
||||
|
||||
return CommandResult.Dismiss();
|
||||
|
||||
@@ -8,7 +8,7 @@ using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Principal;
|
||||
|
||||
using ManagedCommon;
|
||||
using Windows.Management.Deployment;
|
||||
|
||||
// using Wox.Plugin.Logger;
|
||||
@@ -41,6 +41,7 @@ public class TerminalQuery : ITerminalQuery
|
||||
{
|
||||
// TODO: what kind of logging should we do?
|
||||
// Log.Warn($"No Windows Terminal packages installed", typeof(TerminalQuery));
|
||||
Logger.LogWarning("No Windows Terminal packages installed");
|
||||
}
|
||||
|
||||
foreach (var terminal in Terminals)
|
||||
@@ -49,6 +50,7 @@ public class TerminalQuery : ITerminalQuery
|
||||
{
|
||||
// TODO: what kind of logging should we do?
|
||||
// Log.Warn($"Failed to find settings file {terminal.SettingsPath}", typeof(TerminalQuery));
|
||||
Logger.LogWarning($"Failed to find settings file {terminal.SettingsPath}");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
<None Remove="Assets\WindowsTerminal.svg" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\common\ManagedCommon\ManagedCommon.csproj" />
|
||||
<ProjectReference Include="..\..\extensionsdk\Microsoft.CommandPalette.Extensions.Toolkit\Microsoft.CommandPalette.Extensions.Toolkit.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using ManagedCommon;
|
||||
using Microsoft.UI.Xaml.Media.Imaging;
|
||||
|
||||
// using Wox.Infrastructure.Image;
|
||||
@@ -43,6 +44,7 @@ public class TerminalPackage
|
||||
{
|
||||
// Not using wox anymore, TODO: find the right new way to handle this
|
||||
// image.UriSource = new Uri(ImageLoader.ErrorIconPath);
|
||||
Logger.LogError($"Logo file not found: {LogoPath}");
|
||||
}
|
||||
|
||||
return image;
|
||||
|
||||
Reference in New Issue
Block a user