Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/AppInstallerCommonCore/AppInstallerTelemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,16 @@ namespace AppInstaller::Logging
packageVersion = Runtime::GetPackageVersion();
}

ExecutionLevel executionLevel = ExecutionLevel::User;
if (Runtime::IsRunningAsSystem())
{
executionLevel = ExecutionLevel::System;
}
else if (Runtime::IsRunningAsAdmin())
{
executionLevel = ExecutionLevel::Admin;
}

if (IsTelemetryEnabled())
{
AICLI_TraceLoggingWriteActivity(
Expand All @@ -250,11 +260,12 @@ namespace AppInstaller::Logging
if (m_useSummary)
{
m_summary.IsCOMCall = isCOMCall;
m_summary.ExecutionLevel = executionLevel;
}
}

AICLI_LOG(Core, Info, << "WinGet, version [" << version << "], activity [" << *GetActivityId() << ']');
AICLI_LOG(Core, Info, << "Process: " << Filesystem::GetExecutablePathForProcess(GetCurrentProcess()).filename() << "[" << GetCurrentProcessId() << "], Offset: " << &__ImageBase);
AICLI_LOG(Core, Info, << "Process: " << Filesystem::GetExecutablePathForProcess(GetCurrentProcess()).filename() << "[" << GetCurrentProcessId() << "], Level[" << executionLevel << "], Offset: " << &__ImageBase);
AICLI_LOG(Core, Info, << "OS: " << Runtime::GetOSVersion());
AICLI_LOG(Core, Info, << "Command line Args: " << Utility::ConvertToUTF8(GetCommandLineW()));
if (Runtime::IsRunningInPackagedContext())
Expand Down Expand Up @@ -867,6 +878,7 @@ namespace AppInstaller::Logging
AICLI_TraceLoggingStringView(m_summary.FailureFile, "FailureFile"),
TraceLoggingUInt32(m_summary.FailureLine, "FailureLine"),
TraceLoggingBool(m_summary.IsCOMCall, "IsCOMCall"),
TraceLoggingUInt32(static_cast<UINT32>(m_summary.ExecutionLevel), "ExecutionLevel"),
AICLI_TraceLoggingStringView(m_summary.Command, "Command"),
TraceLoggingBool(m_summary.CommandSuccess, "CommandSuccess"),
TraceLoggingBool(m_summary.IsManifestLocal, "IsManifestLocal"),
Expand Down
8 changes: 8 additions & 0 deletions src/AppInstallerCommonCore/Public/AppInstallerTelemetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ namespace AppInstaller::Settings

namespace AppInstaller::Logging
{
enum class ExecutionLevel : UINT32
{
User = 0,
Admin = 1,
System = 2,
};

enum class FailureTypeEnum : UINT32
{
None = 0x0,
Expand Down Expand Up @@ -61,6 +68,7 @@ namespace AppInstaller::Logging

// LogStartup
bool IsCOMCall = false;
ExecutionLevel ExecutionLevel = ExecutionLevel::User;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment says LogStartup but it's only logged to summary?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it is initialized and logged in the LogStartup function. I didn't want to update a critical event for multiple reasons.


// LogCommand
std::string Command;
Expand Down
Loading