Skip to content

Commit c392e45

Browse files
only log what's requested by the user
1 parent c85f725 commit c392e45

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/Tools/dotnet-dsrouter/ADBTcpRouterFactory.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,27 @@ public static void AdbRemovePortReverse(int localPort, int remotePort, bool owns
6666

6767
public static bool RunAdbCommandInternal(string command, string expectedOutput, int expectedExitCode, bool rethrow, ILogger logger)
6868
{
69+
void sdklogger(TraceLevel level, string message)
70+
{
71+
switch (level)
72+
{
73+
case TraceLevel.Error:
74+
logger?.LogError(message);
75+
break;
76+
case TraceLevel.Warning:
77+
logger?.LogWarning(message);
78+
break;
79+
case TraceLevel.Info:
80+
logger?.LogInformation(message);
81+
break;
82+
case TraceLevel.Verbose:
83+
logger?.LogDebug(message);
84+
break;
85+
}
86+
};
87+
6988
//ANDROID_SDK_ROOT is deprecated
70-
string sdkRoot = Environment.GetEnvironmentVariable("ANDROID_HOME") ?? Environment.GetEnvironmentVariable("ANDROID_SDK_ROOT") ?? new AndroidSdkInfo().AndroidSdkPath;
89+
string sdkRoot = Environment.GetEnvironmentVariable("ANDROID_HOME") ?? Environment.GetEnvironmentVariable("ANDROID_SDK_ROOT") ?? new AndroidSdkInfo(logger: sdklogger).AndroidSdkPath;
7190
string adbTool = "adb";
7291

7392
if (!string.IsNullOrEmpty(sdkRoot))

0 commit comments

Comments
 (0)