From bb027aa9c3deb21debf7c0a3423b9f91e18ffb3b Mon Sep 17 00:00:00 2001 From: Stephanie Anderl <46726333+sanderl@users.noreply.github.com> Date: Thu, 18 Jul 2019 11:21:35 -0700 Subject: [PATCH] Added Input pasted event and added to all modes (#593) --- src/CalcViewModel/Common/TraceLogger.cpp | 13 +++++++++++++ src/CalcViewModel/Common/TraceLogger.h | 1 + src/CalcViewModel/StandardCalculatorViewModel.cpp | 1 + src/CalcViewModel/UnitConverterViewModel.cpp | 1 + 4 files changed, 16 insertions(+) diff --git a/src/CalcViewModel/Common/TraceLogger.cpp b/src/CalcViewModel/Common/TraceLogger.cpp index 17fc81dc..22327713 100644 --- a/src/CalcViewModel/Common/TraceLogger.cpp +++ b/src/CalcViewModel/Common/TraceLogger.cpp @@ -33,6 +33,7 @@ namespace CalculatorApp constexpr auto EVENT_NAME_MEMORY_ITEM_LOAD = L"MemoryItemLoad"; constexpr auto EVENT_NAME_VISUAL_STATE_CHANGED = L"VisualStateChanged"; constexpr auto EVENT_NAME_CONVERTER_INPUT_RECEIVED = L"ConverterInputReceived"; + constexpr auto EVENT_NAME_INPUT_PASTED = L"InputPasted"; constexpr auto EVENT_NAME_EXCEPTION = L"Exception"; @@ -369,4 +370,16 @@ namespace CalculatorApp fields.AddUInt64(PDT_PRIVACY_DATA_TAG, PDT_PRODUCT_AND_SERVICE_USAGE); LogLevel2Event(EVENT_NAME_NAV_BAR_OPENED, fields); } + + void TraceLogger::LogInputPasted(ViewMode mode) const + { + if (!GetTraceLoggingProviderEnabled()) + return; + + LoggingFields fields{}; + fields.AddGuid(L"SessionGuid", sessionGuid); + fields.AddString(L"Mode", NavCategory::GetFriendlyName(mode)->Data()); + fields.AddUInt64(PDT_PRIVACY_DATA_TAG, PDT_PRODUCT_AND_SERVICE_USAGE); + LogLevel2Event(EVENT_NAME_INPUT_PASTED, fields); + } } diff --git a/src/CalcViewModel/Common/TraceLogger.h b/src/CalcViewModel/Common/TraceLogger.h index 875a1255..8b3c56be 100644 --- a/src/CalcViewModel/Common/TraceLogger.h +++ b/src/CalcViewModel/Common/TraceLogger.h @@ -54,6 +54,7 @@ namespace CalculatorApp void LogStandardException(CalculatorApp::Common::ViewMode mode, std::wstring_view functionName, _In_ const std::exception& e) const; void LogWinRTException(CalculatorApp::Common::ViewMode mode, std::wstring_view functionName, _In_ winrt::hresult_error const& e) const; void LogPlatformException(CalculatorApp::Common::ViewMode mode, std::wstring_view functionName, _In_ Platform::Exception ^ e) const; + void LogInputPasted(CalculatorApp::Common::ViewMode mode) const; private: // Create an instance of TraceLogger diff --git a/src/CalcViewModel/StandardCalculatorViewModel.cpp b/src/CalcViewModel/StandardCalculatorViewModel.cpp index 1f1aa78e..a0fe4e61 100644 --- a/src/CalcViewModel/StandardCalculatorViewModel.cpp +++ b/src/CalcViewModel/StandardCalculatorViewModel.cpp @@ -765,6 +765,7 @@ void StandardCalculatorViewModel::OnPaste(String ^ pastedString) return; } + TraceLogger::GetInstance().LogInputPasted(GetCalculatorMode()); bool isFirstLegalChar = true; m_standardCalculatorManager.SendCommand(Command::CommandCENTR); bool sendNegate = false; diff --git a/src/CalcViewModel/UnitConverterViewModel.cpp b/src/CalcViewModel/UnitConverterViewModel.cpp index b0153dad..71faf7d2 100644 --- a/src/CalcViewModel/UnitConverterViewModel.cpp +++ b/src/CalcViewModel/UnitConverterViewModel.cpp @@ -893,6 +893,7 @@ void UnitConverterViewModel::OnPaste(String ^ stringToPaste) return; } + TraceLogger::GetInstance().LogInputPasted(Mode); bool isFirstLegalChar = true; bool sendNegate = false; wstring accumulation = L"";