diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
index 273676bfb..6d9e5f755 100644
--- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
+++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs
@@ -473,5 +473,31 @@ namespace Flow.Launcher.Plugin
///
///
public Task UninstallPluginAsync(PluginMetadata pluginMetadata, bool removePluginSettings = false);
+
+ ///
+ /// Log debug message of the time taken to execute a method
+ /// Message will only be logged in Debug mode
+ ///
+ /// The time taken to execute the method in milliseconds
+ public long StopWatchLogDebug(string className, string message, Action action, [CallerMemberName] string methodName = "");
+
+ ///
+ /// Log debug message of the time taken to execute a method asynchronously
+ /// Message will only be logged in Debug mode
+ ///
+ /// The time taken to execute the method in milliseconds
+ public Task StopWatchLogDebugAsync(string className, string message, Func action, [CallerMemberName] string methodName = "");
+
+ ///
+ /// Log info message of the time taken to execute a method
+ ///
+ /// The time taken to execute the method in milliseconds
+ public long StopWatchLogInfo(string className, string message, Action action, [CallerMemberName] string methodName = "");
+
+ ///
+ /// Log info message of the time taken to execute a method asynchronously
+ ///
+ /// The time taken to execute the method in milliseconds
+ public Task StopWatchLogInfoAsync(string className, string message, Func action, [CallerMemberName] string methodName = "");
}
}
diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs
index b67ef6ab6..b7aaef143 100644
--- a/Flow.Launcher/PublicAPIInstance.cs
+++ b/Flow.Launcher/PublicAPIInstance.cs
@@ -31,6 +31,7 @@ using Flow.Launcher.Plugin.SharedCommands;
using Flow.Launcher.ViewModel;
using JetBrains.Annotations;
using Squirrel;
+using Stopwatch = Flow.Launcher.Infrastructure.Stopwatch;
namespace Flow.Launcher
{
@@ -431,6 +432,18 @@ namespace Flow.Launcher
public Task UninstallPluginAsync(PluginMetadata pluginMetadata, bool removePluginSettings = false) =>
PluginManager.UninstallPluginAsync(pluginMetadata, removePluginSettings);
+ public long StopWatchLogDebug(string className, string message, Action action, [CallerMemberName] string methodName = "") =>
+ Stopwatch.Debug($"|{className}.{methodName}|{message}", action);
+
+ public Task StopWatchLogDebugAsync(string className, string message, Func action, [CallerMemberName] string methodName = "") =>
+ Stopwatch.DebugAsync($"|{className}.{methodName}|{message}", action);
+
+ public long StopWatchLogInfo(string className, string message, Action action, [CallerMemberName] string methodName = "") =>
+ Stopwatch.Normal($"|{className}.{methodName}|{message}", action);
+
+ public Task StopWatchLogInfoAsync(string className, string message, Func action, [CallerMemberName] string methodName = "") =>
+ Stopwatch.NormalAsync($"|{className}.{methodName}|{message}", action);
+
#endregion
#region Private Methods