diff --git a/src/Common/AzurePSCmdlet.cs b/src/Common/AzurePSCmdlet.cs index 91fd0ede3d..0c005048cd 100644 --- a/src/Common/AzurePSCmdlet.cs +++ b/src/Common/AzurePSCmdlet.cs @@ -413,7 +413,6 @@ private void WriteSecretsWarningMessage() { WriteWarning(string.Format(Resources.DisplaySecretsWarningMessage, MyInvocation.InvocationName, string.Join(", ", sanitizerInfo.DetectedProperties))); } - WriteDebug($"Sanitizer took {sanitizerInfo.SanitizeDuration.TotalMilliseconds}ms to process the object of cmdlet {MyInvocation.InvocationName}."); } } } diff --git a/src/Common/MetricHelper.cs b/src/Common/MetricHelper.cs index 5c69f9c86c..7baa1ad3fb 100644 --- a/src/Common/MetricHelper.cs +++ b/src/Common/MetricHelper.cs @@ -690,22 +690,27 @@ public override string ToString() StringBuilder sb = new StringBuilder("AzureQoSEvent: "); if (ShowTelemetry) { - foreach(PropertyDescriptor descriptor in TypeDescriptor.GetProperties((this))) - { - string name = descriptor.Name; - object value = descriptor.GetValue(this); - sb.Append($"{name}: {value}; "); - } + foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties((this))) + { + string name = descriptor.Name; + object value = descriptor.GetValue(this); + sb.Append($"{name}: {value}; "); + } //InstallationId and InternalCalledCmdlets are properties of MetricHelper and not in qosEventObject. sb.Append($"InternalCalledCmdlets: {Microsoft.WindowsAzure.Commands.Common.MetricHelper.InternalCalledCmdlets}; InstallaionId: {Microsoft.WindowsAzure.Commands.Common.MetricHelper.InstallationId}"); } else { - sb = sb.Append($" Module: {ModuleName}:{ModuleVersion}; CommandName: {CommandName}; PSVersion: {PSVersion}"); + sb.Append($" Module: {ModuleName}:{ModuleVersion}; CommandName: {CommandName}; PSVersion: {PSVersion}"); } sb.Append($"; IsSuccess: {IsSuccess}; Duration: {Duration}"); + if (SanitizerInfo?.ShowSecretsWarning == true) + { + sb.Append($"; SanitizeDuration: {SanitizerInfo.SanitizeDuration}"); + } + if (Exception != null) { sb.Append($"; Exception: {Exception.Message};");