Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report informational messages when platform logs are enabled #2361

Merged
merged 1 commit into from
Mar 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions src/Microsoft.TestPlatform.Client/DesignMode/DesignModeClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,34 @@ public void SendTestMessage(TestMessageLevel level, string message)
/// <param name="e"></param>
public void TestRunMessageHandler(object sender, TestRunMessageEventArgs e)
{
if (e.Level == TestMessageLevel.Error || e.Level == TestMessageLevel.Warning)
// save into trace log and send the message to the IDE
//
// there is a mismatch between log levels that VS uses and that TP
// uses. In VS you can choose Trace level which will enable Test platform
// logs on Verbose level. Below we report Errors and warnings always to the
// IDE no matter what the level of VS logging is, but Info only when the Eqt trace
// info level is enabled (so only when VS enables Trace logging)
switch (e.Level)
{
var payload = new TestMessagePayload { MessageLevel = e.Level, Message = e.Message };
this.communicationManager.SendMessage(MessageType.TestMessage, payload);
case TestMessageLevel.Error:
EqtTrace.Error(e.Message);
SendTestMessage(e.Level, e.Message);
break;
case TestMessageLevel.Warning:
EqtTrace.Warning(e.Message);
SendTestMessage(e.Level, e.Message);
break;

case TestMessageLevel.Informational:
EqtTrace.Info(e.Message);

if (EqtTrace.IsInfoEnabled)
SendTestMessage(e.Level, e.Message);
break;


default:
throw new NotSupportedException($"Test message level '{e.Level}' is not supported.");
}
}

Expand Down