mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 14:13:30 -07:00
Merge branch 'telemetry' of https://github.com/sanderl/calculator into telemetry
This commit is contained in:
commit
f5fa7c3d4e
3 changed files with 26 additions and 2 deletions
|
@ -155,13 +155,19 @@ void ApplicationViewModel::OnModeChanged()
|
|||
auto resProvider = AppResourceProvider::GetInstance();
|
||||
CategoryName = resProvider.GetResourceString(NavCategory::GetNameResourceKey(m_mode));
|
||||
|
||||
// This is the only place where a ViewMode enum should be cast to an int.
|
||||
//
|
||||
// Cast mode to an int in order to save it to app data.
|
||||
// Save the changed mode, so that the new window launches in this mode.
|
||||
// Don't save until after we have adjusted to the new mode, so we don't save a mode that fails to load.
|
||||
ApplicationData::Current->LocalSettings->Values->Insert(ModePropertyName, NavCategory::Serialize(m_mode));
|
||||
|
||||
TraceLogger::GetInstance().LogModeChangeEnd(m_mode, ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
|
||||
|
||||
// Do not log mode change on first launch
|
||||
if (NavCategory::IsValidViewMode(m_PreviousMode))
|
||||
{
|
||||
TraceLogger::GetInstance().LogModeChange(m_mode);
|
||||
}
|
||||
|
||||
RaisePropertyChanged(ClearMemoryVisibilityPropertyName);
|
||||
}
|
||||
|
||||
|
|
|
@ -75,6 +75,8 @@ namespace CalculatorApp
|
|||
constexpr auto EVENT_NAME_NAV_BAR_OPENED = L"NavBarOpened";
|
||||
constexpr auto EVENT_NAME_CORE_WINDOW_WAS_NULL = L"CoreWindowWasNull";
|
||||
|
||||
constexpr auto EVENT_NAME_MODE_CHANGED = L"ModeChanged";
|
||||
|
||||
constexpr auto EVENT_NAME_EXCEPTION = L"Exception";
|
||||
|
||||
constexpr auto PDT_PRIVACY_DATA_TAG = L"PartA_PrivTags";
|
||||
|
@ -254,6 +256,7 @@ namespace CalculatorApp
|
|||
fields.AddString(L"CalculatorMode", NavCategory::GetFriendlyName(mode)->Data());
|
||||
fields.AddUInt32(L"WindowId", windowId);
|
||||
LogLevel3Event(EVENT_NAME_CALCULATOR_VIEWED_IN_SESSION, fields);
|
||||
LogLevel2Event(EVENT_NAME_MODE_CHANGED, fields);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -523,6 +526,20 @@ namespace CalculatorApp
|
|||
}
|
||||
}
|
||||
|
||||
void TraceLogger::LogModeChange(ViewMode mode) const
|
||||
{
|
||||
if (!GetTraceLoggingProviderEnabled())
|
||||
return;
|
||||
|
||||
if (NavCategory::IsValidViewMode(mode))
|
||||
{
|
||||
LoggingFields fields{};
|
||||
// cast mode to an int for telemetry
|
||||
fields.AddInt32(L"CalcMode", NavCategory::Serialize(mode));
|
||||
LogLevel2Event(EVENT_NAME_MODE_CHANGE_BEGIN, fields);
|
||||
}
|
||||
}
|
||||
|
||||
void TraceLogger::LogHistoryItemLoadBegin() const
|
||||
{
|
||||
if (!GetTraceLoggingProviderEnabled())
|
||||
|
|
|
@ -64,6 +64,7 @@ namespace CalculatorApp
|
|||
void LogSingleMemoryUsed(unsigned int) const;
|
||||
void LogSharedMemoryUsed(std::wstring_view, std::wstring_view, unsigned int) const;
|
||||
void LogMemoryBodyOpened() const;
|
||||
void LogModeChange(CalculatorApp::Common::ViewMode mode) const;
|
||||
void LogMemoryFlyoutOpenBegin(unsigned int) const;
|
||||
void LogDebug(std::wstring_view debugData);
|
||||
void LogMemoryFlyoutOpenEnd(unsigned int) const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue