Use a multi-proc aware MSBuild logger (#8371)

Make use of the MSBuild distributed logger functionality and add a
forwarding logger. When in a multi-proc build, the forwarding logger
will decide which events to forward to the main node to be logged.
Without this, all events are routed and a perf penalty is incurred.
This commit is contained in:
Andy Gerlicher 2018-01-11 15:30:56 -08:00 committed by Nick Guerrera
parent ed2ca5d49a
commit 2b3ade043d
4 changed files with 51 additions and 7 deletions

View file

@ -11,7 +11,7 @@ using System.Collections.Generic;
namespace Microsoft.DotNet.Tools.MSBuild
{
public sealed class MSBuildLogger : Logger
public sealed class MSBuildLogger : INodeLogger
{
private readonly IFirstTimeUseNoticeSentinel _sentinel =
new FirstTimeUseNoticeSentinel(new CliFolderPathCalculator());
@ -38,7 +38,12 @@ namespace Microsoft.DotNet.Tools.MSBuild
}
}
public override void Initialize(IEventSource eventSource)
public void Initialize(IEventSource eventSource, int nodeCount)
{
Initialize(eventSource);
}
public void Initialize(IEventSource eventSource)
{
try
{
@ -76,7 +81,7 @@ namespace Microsoft.DotNet.Tools.MSBuild
FormatAndSend(_telemetry, args);
}
public override void Shutdown()
public void Shutdown()
{
try
{
@ -86,8 +91,10 @@ namespace Microsoft.DotNet.Tools.MSBuild
{
// Exceptions during telemetry shouldn't cause anything else to fail
}
base.Shutdown();
}
public LoggerVerbosity Verbosity { get; set; }
public string Parameters { get; set; }
}
}