fix: Better log required information (#1434)
Signed-off-by: Sheng Chen <sheche@microsoft.com>
This commit is contained in:
Родитель
6462613fba
Коммит
e0b4554c43
|
@ -91,38 +91,43 @@ export class BuildServerController implements Disposable {
|
|||
}
|
||||
})
|
||||
);
|
||||
this.checkGradleExecutable();
|
||||
this.checkProxy();
|
||||
this.checkMachineStatus();
|
||||
}
|
||||
|
||||
public dispose() {
|
||||
this.disposable.dispose();
|
||||
}
|
||||
|
||||
private checkGradleExecutable(): void {
|
||||
private checkMachineStatus() {
|
||||
const machineStatus: { [key: string]: string } = {};
|
||||
if (this.isGradleExecutableOnPath()) {
|
||||
machineStatus.gradleExecutableFound = "true";
|
||||
}
|
||||
if (this.hasProxy()) {
|
||||
machineStatus.hasProxy = "true";
|
||||
}
|
||||
if (Object.keys(machineStatus).length > 0) {
|
||||
sendInfo("", {
|
||||
kind: "machineStatus",
|
||||
data: JSON.stringify(machineStatus),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private isGradleExecutableOnPath(): boolean {
|
||||
if (process.env.PATH) {
|
||||
const pathDirectories = process.env.PATH.split(path.delimiter);
|
||||
for (const dir of pathDirectories) {
|
||||
const executablePath = path.join(dir, "gradle");
|
||||
if (fse.existsSync(executablePath) && fse.statSync(executablePath).isFile()) {
|
||||
sendInfo("", {
|
||||
kind: "hasGradleExecutableInPath",
|
||||
data: "true",
|
||||
});
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private checkProxy(): void {
|
||||
const proxy =
|
||||
process.env.HTTP_PROXY ?? process.env.HTTPS_PROXY ?? workspace.getConfiguration("http").get("proxy");
|
||||
if (proxy) {
|
||||
sendInfo("", {
|
||||
kind: "hasProxy",
|
||||
data: "true",
|
||||
});
|
||||
}
|
||||
private hasProxy(): boolean {
|
||||
return !!(process.env.HTTP_PROXY || process.env.HTTPS_PROXY || workspace.getConfiguration("http").get("proxy"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as vscode from "vscode";
|
||||
import { sendInfo } from "vscode-extension-telemetry-wrapper";
|
||||
|
||||
export enum LogVerbosity {
|
||||
DEBUG = 0,
|
||||
|
@ -51,7 +52,12 @@ export class Logger {
|
|||
}
|
||||
|
||||
public error(...messages: string[]): void {
|
||||
this.log(messages.join(" "), LogVerbosity.ERROR);
|
||||
const error = messages.join(" ");
|
||||
this.log(error, LogVerbosity.ERROR);
|
||||
sendInfo("", {
|
||||
kind: "gradleTaskServerError",
|
||||
data: error,
|
||||
});
|
||||
}
|
||||
|
||||
public debug(...messages: string[]): void {
|
||||
|
|
Загрузка…
Ссылка в новой задаче