Skip to content

Commit

Permalink
Improve diagnostic logging for DotNetRuntimeInfo / MSBuildTests
Browse files Browse the repository at this point in the history
  • Loading branch information
tintoy committed Oct 31, 2019
1 parent f0efbe3 commit 09c3313
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
9 changes: 4 additions & 5 deletions src/LanguageServer.Common/Utilities/DotNetRuntimeInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,12 @@ public static DotNetRuntimeInfo GetCurrent(string baseDirectory = null)
processOutput = localOutputBuffer.ToString();
}

// Only log output if there's a problem.
if (dotnetInfoProcess.ExitCode != 0)
if ( Log.IsEnabled(Serilog.Events.LogEventLevel.Verbose) )
{
if (!String.IsNullOrWhiteSpace(processOutput))
Log.Debug("{Command} returned the following text on STDOUT / STDERR.\n\n{DotNetInfoOutput:l}", command, processOutput);
else
Log.Debug("{Command} returned no output on STDOUT / STDERR.");
Log.Debug("{Command} returned the following text on STDOUT / STDERR.\n\n{DotNetInfoOutput:l}", command, processOutput);
else
Log.Debug("{Command} returned no output on STDOUT / STDERR.");
}

using (StringReader bufferReader = new StringReader(processOutput))
Expand Down
11 changes: 2 additions & 9 deletions test/LanguageServer.Engine.Tests/MSBuildTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace MSBuildProjectTools.LanguageServer.Tests
/// Tests for MSBuild integration.
/// </summary>
public class MSBuildTests
: TestBase
{
/// <summary>
/// The directory for test files.
Expand All @@ -32,18 +33,10 @@ public class MSBuildTests
/// Output for the current test.
/// </param>
public MSBuildTests(ITestOutputHelper testOutput)
: base(testOutput)
{
if (testOutput == null)
throw new ArgumentNullException(nameof(testOutput));

TestOutput = testOutput;
}

/// <summary>
/// Output for the current test.
/// </summary>
public ITestOutputHelper TestOutput { get; }

// TODO: More realistic tests for working with MSBuild evaluation projects.

/// <summary>
Expand Down

0 comments on commit 09c3313

Please sign in to comment.