Skip to content

Commit

Permalink
fix: Use built-in logger for doctor checks (#893)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach authored Jan 5, 2024
1 parent 3048319 commit 5fb33ad
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/doctor/checks.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import {resolveExecutablePath} from './utils';
import {system, fs, logger, doctor} from '@appium/support';
import {system, fs, doctor} from '@appium/support';
import path from 'path';
import '@colors/colors';
import {getAndroidBinaryPath, getSdkRootFromEnv} from 'appium-adb';

const log = logger.getLogger('AndroidDoctor');

const JAVA_HOME_VAR_NAME = system.isWindows() ? '%JAVA_HOME%' : '$JAVA_HOME';
const ENVIRONMENT_VARS_TUTORIAL_URL = 'https://github.com/appium/java-client/blob/master/docs/environment.md';
Expand Down Expand Up @@ -113,6 +112,9 @@ export const javaHomeValueCheck = new JavaHomeValueCheck();

/** @satisfies {import('@appium/types').IDoctorCheck} */
export class AndroidSdkCheck {
/** @type {import('@appium/types').AppiumLogger} */
log;

TOOL_NAMES = ['adb', 'emulator', `apkanalyzer${system.isWindows() ? '.bat' : ''}`];

async diagnose() {
Expand All @@ -124,11 +126,11 @@ export class AndroidSdkCheck {
);
}

log.info(` Checking ${listOfTools}`);
this.log.info(` Checking ${listOfTools}`);
const missingBinaries = [];
for (const binary of this.TOOL_NAMES) {
try {
log.info(` '${binary}' exists in ${await getAndroidBinaryPath(binary)}`);
this.log.info(` '${binary}' exists in ${await getAndroidBinaryPath(binary)}`);
} catch (e) {
missingBinaries.push(binary);
}
Expand Down

0 comments on commit 5fb33ad

Please sign in to comment.