Skip to content

Commit 1c5829b

Browse files
authored
Added sanitize duration in the debug message and removed in EndProcessing. (#413)
1 parent 0b6cb59 commit 1c5829b

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/Common/AzurePSCmdlet.cs

-1
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,6 @@ private void WriteSecretsWarningMessage()
413413
{
414414
WriteWarning(string.Format(Resources.DisplaySecretsWarningMessage, MyInvocation.InvocationName, string.Join(", ", sanitizerInfo.DetectedProperties)));
415415
}
416-
WriteDebug($"Sanitizer took {sanitizerInfo.SanitizeDuration.TotalMilliseconds}ms to process the object of cmdlet {MyInvocation.InvocationName}.");
417416
}
418417
}
419418
}

src/Common/MetricHelper.cs

+12-7
Original file line numberDiff line numberDiff line change
@@ -690,22 +690,27 @@ public override string ToString()
690690
StringBuilder sb = new StringBuilder("AzureQoSEvent: ");
691691
if (ShowTelemetry)
692692
{
693-
foreach(PropertyDescriptor descriptor in TypeDescriptor.GetProperties((this)))
694-
{
695-
string name = descriptor.Name;
696-
object value = descriptor.GetValue(this);
697-
sb.Append($"{name}: {value}; ");
698-
}
693+
foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties((this)))
694+
{
695+
string name = descriptor.Name;
696+
object value = descriptor.GetValue(this);
697+
sb.Append($"{name}: {value}; ");
698+
}
699699
//InstallationId and InternalCalledCmdlets are properties of MetricHelper and not in qosEventObject.
700700
sb.Append($"InternalCalledCmdlets: {Microsoft.WindowsAzure.Commands.Common.MetricHelper.InternalCalledCmdlets}; InstallaionId: {Microsoft.WindowsAzure.Commands.Common.MetricHelper.InstallationId}");
701701
}
702702
else
703703
{
704-
sb = sb.Append($" Module: {ModuleName}:{ModuleVersion}; CommandName: {CommandName}; PSVersion: {PSVersion}");
704+
sb.Append($" Module: {ModuleName}:{ModuleVersion}; CommandName: {CommandName}; PSVersion: {PSVersion}");
705705
}
706706

707707
sb.Append($"; IsSuccess: {IsSuccess}; Duration: {Duration}");
708708

709+
if (SanitizerInfo?.ShowSecretsWarning == true)
710+
{
711+
sb.Append($"; SanitizeDuration: {SanitizerInfo.SanitizeDuration}");
712+
}
713+
709714
if (Exception != null)
710715
{
711716
sb.Append($"; Exception: {Exception.Message};");

0 commit comments

Comments
 (0)