mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-01-16 01:06:50 +01:00
Adding events to track the following:
<table style="width:100%">
<tr>
<th>Event Name</th>
<th>Description</th>
<th>Data collected</th>
</tr>
<tr>
<td>Microsoft.PowerToys.LightSwitch_EnableLightSwitch</td>
<td>Triggered when Light Switch is enabled or disabled.</td>
<td>Whether the module is enabled or disabled (bool)</td>
</tr>
<tr>
<td>Microsoft.PowerToys.LightSwitch_ShortcutInvoked</td>
<td>Occurs when the shortcut for Light Switch is invoked.</td>
<td></td>
</tr>
<tr>
<td>Microsoft.PowerToys.LightSwitch_ScheduleModeToggled</td>
<td>Occurs when a new schedule mode is selected for Light Switch.</td>
<td>The new mode selected (string)</td>
</tr>
<tr>
<td>Microsoft.PowerToys.LightSwitch_ThemeTargetChanged</td>
<td>Occurs when the options for targeting the system or apps is
updated.</td>
<td>The new options selected (two bools)</td>
</tr>
</table>
The above events that are related to Light Switch settings are tracked
in the "LoadSettings" function inside the service but only if the value
has changed. The Enabled event as well as the Shortcut event are tracked
in the module interface.
40 lines
1.0 KiB
C++
40 lines
1.0 KiB
C++
#include "pch.h"
|
|
#include "trace.h"
|
|
#include <TraceLoggingProvider.h>
|
|
|
|
TRACELOGGING_DEFINE_PROVIDER(
|
|
g_hProvider,
|
|
"Microsoft.PowerToys",
|
|
// {38e8889b-9731-53f5-e901-e8a7c1753074}
|
|
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
|
TraceLoggingOptionProjectTelemetry());
|
|
|
|
void Trace::RegisterProvider()
|
|
{
|
|
TraceLoggingRegister(g_hProvider);
|
|
}
|
|
|
|
void Trace::UnregisterProvider()
|
|
{
|
|
TraceLoggingUnregister(g_hProvider);
|
|
}
|
|
|
|
void Trace::Enable(bool enabled) noexcept
|
|
{
|
|
TraceLoggingWrite(
|
|
g_hProvider,
|
|
"LightSwitch_EnableLightSwitch",
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE),
|
|
TraceLoggingBoolean(enabled, "Enabled"));
|
|
}
|
|
|
|
void Trace::ShortcutInvoked() noexcept
|
|
{
|
|
TraceLoggingWrite(
|
|
g_hProvider,
|
|
"LightSwitch_ShortcutInvoked",
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
|
}
|