diff --git a/src/CalcViewModel/Common/TraceLogger.cpp b/src/CalcViewModel/Common/TraceLogger.cpp index 17fc81d..2232771 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 875a125..8b3c56b 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 1f1aa78..a0fe4e6 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 b0153da..71faf7d 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"";