Skip to content

Commit

Permalink
Log action dispatch occurrence (#17718)
Browse files Browse the repository at this point in the history
Some simple logic to report whenever an action has successfully occurred
(and what ShortcutAction was used).

Note, there will be some false positives here from startup. I noticed we
get a `newTab` on launch. This is probably a result of restoring the
window layout of the previous session since we're using ActionAndArgs
for that.
  • Loading branch information
carlos-zamora authored Aug 21, 2024
1 parent 628e99f commit 56cfb77
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/cascadia/TerminalApp/ShortcutActionDispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,20 @@ namespace winrt::TerminalApp::implementation
default:
return false;
}
return eventArgs.Handled();
const auto handled = eventArgs.Handled();

if (handled)
{
TraceLoggingWrite(
g_hTerminalAppProvider,
"ActionDispatched",
TraceLoggingDescription("Event emitted when an action was successfully performed"),
TraceLoggingValue(static_cast<int>(actionAndArgs.Action()), "Action"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
}

return handled;
}

bool ShortcutActionDispatch::DoAction(const ActionAndArgs& actionAndArgs)
Expand Down

0 comments on commit 56cfb77

Please sign in to comment.