-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add MSTest trace logs when using MTP (#4833)
- Loading branch information
1 parent
8660ba9
commit 935e299
Showing
5 changed files
with
40 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/Adapter/MSTest.TestAdapter/TestingPlatformAdapter/BridgedTraceLogger.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
#if !WINDOWS_UWP | ||
using Microsoft.Testing.Platform.Logging; | ||
using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; | ||
|
||
namespace Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
[SuppressMessage("ApiDesign", "RS0030:Do not use banned APIs", Justification = "MTP logger bridge")] | ||
internal sealed class BridgedTraceLogger : IAdapterTraceLogger | ||
{ | ||
private readonly ILogger _logger; | ||
|
||
public BridgedTraceLogger(ILogger logger) | ||
=> _logger = logger; | ||
|
||
public void LogError(string format, params object?[] args) | ||
=> _logger.LogError(string.Format(CultureInfo.CurrentCulture, format, args)); | ||
|
||
public void LogInfo(string format, params object?[] args) | ||
=> _logger.LogInformation(string.Format(CultureInfo.CurrentCulture, format, args)); | ||
|
||
public void LogWarning(string format, params object?[] args) | ||
=> _logger.LogWarning(string.Format(CultureInfo.CurrentCulture, format, args)); | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters