mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
Add telemetry for memory item load
This commit is contained in:
parent
4790946061
commit
e2f347d555
3 changed files with 19 additions and 0 deletions
|
@ -78,6 +78,7 @@ namespace CalculatorApp
|
|||
constexpr auto EVENT_NAME_MODE_CHANGED = L"ModeChanged";
|
||||
constexpr auto EVENT_NAME_DATE_CALCULATION_MODE_USED = L"DateCalculationModeUsed";
|
||||
constexpr auto EVENT_NAME_HISTORY_ITEM_LOAD = L"HistoryItemLoad";
|
||||
constexpr auto EVENT_NAME_MEMORY_ITEM_LOAD = L"MemoryItemLoad";
|
||||
|
||||
constexpr auto EVENT_NAME_EXCEPTION = L"Exception";
|
||||
|
||||
|
@ -556,6 +557,21 @@ namespace CalculatorApp
|
|||
LogLevel2Event(EVENT_NAME_HISTORY_ITEM_LOAD, fields);
|
||||
}
|
||||
|
||||
void TraceLogger::LogMemoryItemLoad(ViewMode mode, int maxMemoryIndex, int loadedIndex) const
|
||||
{
|
||||
if (!GetTraceLoggingProviderEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LoggingFields fields{};
|
||||
// cast mode to an int for telemetry
|
||||
fields.AddInt32(L"CalcMode", NavCategory::Serialize(mode));
|
||||
fields.AddInt32(L"maxIndex", maxMemoryIndex);
|
||||
fields.AddInt32(L"loadedIndex", loadedIndex);
|
||||
LogLevel2Event(EVENT_NAME_MEMORY_ITEM_LOAD, fields);
|
||||
}
|
||||
|
||||
void TraceLogger::LogHistoryItemLoadBegin() const
|
||||
{
|
||||
if (!GetTraceLoggingProviderEnabled())
|
||||
|
|
|
@ -66,6 +66,7 @@ namespace CalculatorApp
|
|||
void LogMemoryBodyOpened() const;
|
||||
void LogModeChange(CalculatorApp::Common::ViewMode mode) const;
|
||||
void LogHistoryItemLoad(CalculatorApp::Common::ViewMode mode, int historyListSize) const;
|
||||
void LogMemoryItemLoad(CalculatorApp::Common::ViewMode mode, int maxMemoryIndex, int loadedIndex) const;
|
||||
void LogMemoryFlyoutOpenBegin(unsigned int) const;
|
||||
void LogDebug(std::wstring_view debugData);
|
||||
void LogMemoryFlyoutOpenEnd(unsigned int) const;
|
||||
|
|
|
@ -1101,6 +1101,8 @@ void StandardCalculatorViewModel::OnMemoryItemPressed(Object ^ memoryItemPositio
|
|||
HideMemoryClicked();
|
||||
int windowId = Utils::GetWindowId();
|
||||
TraceLogger::GetInstance().LogMemoryUsed(windowId, boxedPosition->Value, IsStandard, IsScientific, IsProgrammer, MemorizedNumbers->Size);
|
||||
auto mode = IsStandard ? ViewMode::Standard : IsScientific ? ViewMode::Scientific : ViewMode::Programmer;
|
||||
TraceLogger::GetInstance().LogMemoryItemLoad(mode, MemorizedNumbers->Size - 1, boxedPosition->Value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue