forked from microsoft/testfx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBridgedTraceLogger.cs
27 lines (20 loc) · 1.09 KB
/
BridgedTraceLogger.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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