Skip to content

Commit

Permalink
Merge pull request #54236 from dotnet/merges/main-to-main-vs-deps
Browse files Browse the repository at this point in the history
Merge main to main-vs-deps
  • Loading branch information
msftbot[bot] authored Jun 20, 2021
2 parents ead5ec8 + 0985b4d commit 77d2dfa
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/VisualStudio/Core/Def/Telemetry/VSTelemetryLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public bool IsEnabled(FunctionId functionId)

public void Log(FunctionId functionId, LogMessage logMessage)
{
if (logMessage.LogLevel < LogLevel.Information)
if (IgnoreMessage(logMessage))
{
return;
}
Expand All @@ -53,6 +53,11 @@ public void Log(FunctionId functionId, LogMessage logMessage)

public void LogBlockStart(FunctionId functionId, LogMessage logMessage, int blockId, CancellationToken cancellationToken)
{
if (IgnoreMessage(logMessage))
{
return;
}

try
{
// guard us from exception thrown by telemetry
Expand All @@ -67,6 +72,11 @@ public void LogBlockStart(FunctionId functionId, LogMessage logMessage, int bloc

public void LogBlockEnd(FunctionId functionId, LogMessage logMessage, int blockId, int delta, CancellationToken cancellationToken)
{
if (IgnoreMessage(logMessage))
{
return;
}

try
{
// guard us from exception thrown by telemetry
Expand All @@ -89,6 +99,9 @@ public void LogBlockEnd(FunctionId functionId, LogMessage logMessage, int blockI
}
}

private static bool IgnoreMessage(LogMessage logMessage)
=> logMessage.LogLevel < LogLevel.Information;

private static LogType GetKind(LogMessage logMessage)
=> logMessage is KeyValueLogMessage kvLogMessage
? kvLogMessage.Kind
Expand Down

0 comments on commit 77d2dfa

Please sign in to comment.