mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[PT Run] Improve the Win32 Program Indexing speed (#11364)
This commit is contained in:
@@ -17,6 +17,31 @@ namespace Microsoft.Plugin.Program.Logger
|
||||
/// </summary>
|
||||
internal static class ProgramLogger
|
||||
{
|
||||
/// <summary>
|
||||
/// Logs an warning
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.Synchronized)]
|
||||
internal static void Warn(string message, Exception ex, Type fullClassName, string loadingProgramPath, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0)
|
||||
{
|
||||
string calledMethod = "Not available";
|
||||
|
||||
if (ex != null)
|
||||
{
|
||||
string exceptionCalledMethod = ex.TargetSite != null ? ex.TargetSite.ToString() : ex.StackTrace;
|
||||
if (!string.IsNullOrEmpty(exceptionCalledMethod))
|
||||
{
|
||||
calledMethod = exceptionCalledMethod;
|
||||
}
|
||||
}
|
||||
|
||||
var msg = $"\n\t\tProgram path: {loadingProgramPath}"
|
||||
+ $"\n\t\tException thrown in called method: {calledMethod}"
|
||||
+ $"\n\t\tPossible interpretation of the error: {message}";
|
||||
|
||||
// removed looping logic since that is inside Log class
|
||||
Log.Warn(msg, fullClassName, methodName, sourceFilePath, sourceLineNumber);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs an exception
|
||||
/// </summary>
|
||||
@@ -29,7 +54,7 @@ namespace Microsoft.Plugin.Program.Logger
|
||||
|
||||
if (IsKnownWinProgramError(ex, methodName) || IsKnownUWPProgramError(ex, methodName))
|
||||
{
|
||||
possibleResolution = "Can be ignored and Wox should still continue, however the program may not be loaded";
|
||||
possibleResolution = "Can be ignored and PowerToys Run should still continue, however the program may not be loaded";
|
||||
errorStatus = "KNOWN";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user