2019-09-05 00:26:26 +08:00
|
|
|
#include "pch.h"
|
|
|
|
#include "trace.h"
|
|
|
|
|
2020-02-12 18:03:40 +08:00
|
|
|
#include "general_settings.h"
|
|
|
|
|
2019-09-05 00:26:26 +08:00
|
|
|
TRACELOGGING_DEFINE_PROVIDER(
|
2019-12-27 00:26:11 +08:00
|
|
|
g_hProvider,
|
|
|
|
"Microsoft.PowerToys",
|
|
|
|
// {38e8889b-9731-53f5-e901-e8a7c1753074}
|
|
|
|
(0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74),
|
|
|
|
TraceLoggingOptionProjectTelemetry());
|
2019-09-05 00:26:26 +08:00
|
|
|
|
2019-12-27 00:26:11 +08:00
|
|
|
void Trace::RegisterProvider()
|
|
|
|
{
|
|
|
|
TraceLoggingRegister(g_hProvider);
|
2019-09-05 00:26:26 +08:00
|
|
|
}
|
|
|
|
|
2019-12-27 00:26:11 +08:00
|
|
|
void Trace::UnregisterProvider()
|
|
|
|
{
|
|
|
|
TraceLoggingUnregister(g_hProvider);
|
2019-09-05 00:26:26 +08:00
|
|
|
}
|
|
|
|
|
2020-02-12 18:03:40 +08:00
|
|
|
void Trace::EventLaunch(const std::wstring& versionNumber, bool isProcessElevated)
|
2019-12-27 00:26:11 +08:00
|
|
|
{
|
|
|
|
TraceLoggingWrite(
|
|
|
|
g_hProvider,
|
|
|
|
"Runner_Launch",
|
|
|
|
TraceLoggingWideString(versionNumber.c_str(), "Version"),
|
2020-02-12 18:03:40 +08:00
|
|
|
TraceLoggingBoolean(isProcessElevated, "Elevated"),
|
|
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
|
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
|
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
|
|
|
}
|
|
|
|
|
|
|
|
void Trace::SettingsChanged(const GeneralSettings& settings)
|
|
|
|
{
|
|
|
|
std::wstring enabledModules;
|
|
|
|
for (const auto& [name, isEnabled] : settings.isModulesEnabledMap)
|
|
|
|
{
|
|
|
|
if (isEnabled)
|
|
|
|
{
|
|
|
|
if (!enabledModules.empty())
|
|
|
|
{
|
|
|
|
enabledModules += L", ";
|
|
|
|
}
|
|
|
|
|
|
|
|
enabledModules += name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TraceLoggingWrite(
|
|
|
|
g_hProvider,
|
|
|
|
"GeneralSettingsChanged",
|
|
|
|
TraceLoggingBoolean(settings.isStartupEnabled, "RunAtStartup"),
|
|
|
|
TraceLoggingWideString(settings.startupDisabledReason.c_str(), "StartupDisabledReason"),
|
|
|
|
TraceLoggingWideString(enabledModules.c_str(), "ModulesEnabled"),
|
|
|
|
TraceLoggingBoolean(settings.isRunElevated, "AlwaysRunElevated"),
|
2020-04-21 15:30:12 +08:00
|
|
|
TraceLoggingBoolean(settings.downloadUpdatesAutomatically, "DownloadUpdatesAutomatically"),
|
2020-02-12 18:03:40 +08:00
|
|
|
TraceLoggingWideString(settings.theme.c_str(), "Theme"),
|
2019-12-27 00:26:11 +08:00
|
|
|
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
|
|
|
|
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
|
|
|
|
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
|
2019-09-05 00:26:26 +08:00
|
|
|
}
|