Skip to content

Commit e4ecea0

Browse files
authored
Merge pull request #3509 from Flow-Launcher/mainvm_more_log
Add more debug log info for query
2 parents a2a8c50 + 1973163 commit e4ecea0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,10 +1215,14 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
12151215
{
12161216
_updateSource?.Cancel();
12171217

1218+
App.API.LogDebug(ClassName, $"Start query with text: <{QueryText}>");
1219+
12181220
var query = await ConstructQueryAsync(QueryText, Settings.CustomShortcuts, Settings.BuiltinShortcuts);
12191221

12201222
if (query == null) // shortcut expanded
12211223
{
1224+
App.API.LogDebug(ClassName, $"Clear query results");
1225+
12221226
// Hide and clear results again because running query may show and add some results
12231227
Results.Visibility = Visibility.Collapsed;
12241228
Results.Clear();
@@ -1233,6 +1237,8 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
12331237
return;
12341238
}
12351239

1240+
App.API.LogDebug(ClassName, $"Start query with ActionKeyword <{query.ActionKeyword}> and RawQuery <{query.RawQuery}>");
1241+
12361242
_updateSource = new CancellationTokenSource();
12371243

12381244
ProgressBarVisibility = Visibility.Hidden;
@@ -1253,6 +1259,9 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
12531259

12541260
var plugins = PluginManager.ValidPluginsForQuery(query);
12551261

1262+
var validPluginNames = plugins.Select(x => $"<{x.Metadata.Name}>");
1263+
App.API.LogDebug(ClassName, $"Valid <{plugins.Count}> plugins: {string.Join(" ", validPluginNames)}");
1264+
12561265
if (plugins.Count == 1)
12571266
{
12581267
PluginIconPath = plugins.Single().Metadata.IcoPath;
@@ -1321,6 +1330,8 @@ private async Task QueryResultsAsync(bool searchDelay, bool isReQuery = false, b
13211330
// Local function
13221331
async Task QueryTaskAsync(PluginPair plugin, CancellationToken token)
13231332
{
1333+
App.API.LogDebug(ClassName, $"Wait for querying plugin <{plugin.Metadata.Name}>");
1334+
13241335
if (searchDelay)
13251336
{
13261337
var searchDelayTime = plugin.Metadata.SearchDelayTime ?? Settings.SearchDelayTime;
@@ -1359,6 +1370,8 @@ async Task QueryTaskAsync(PluginPair plugin, CancellationToken token)
13591370

13601371
if (token.IsCancellationRequested) return;
13611372

1373+
App.API.LogDebug(ClassName, $"Update results for plugin <{plugin.Metadata.Name}>");
1374+
13621375
if (!_resultsUpdateChannelWriter.TryWrite(new ResultsForUpdate(resultsCopy, plugin.Metadata, query,
13631376
token, reSelect)))
13641377
{
@@ -1448,6 +1461,8 @@ private void RemoveOldQueryResults(Query query)
14481461
{
14491462
if (_lastQuery?.ActionKeyword != query?.ActionKeyword)
14501463
{
1464+
App.API.LogDebug(ClassName, $"Remove old results");
1465+
14511466
Results.Clear();
14521467
}
14531468
}

0 commit comments

Comments
 (0)