Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
Make upload verbosity be conditional and extend filtering
Browse files Browse the repository at this point in the history
* Building always verbosely but upload only verbosely when requested
* Filtering of spurious messages now with regex list and for all platforms
  • Loading branch information
elektronikworkshop authored and adiazulay committed Jan 19, 2021
1 parent fed508f commit 30210dc
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions src/arduino/arduino.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ export class ArduinoApp {
* manages the build state.
* @param buildMode See build()
* @param buildDir See build()
* @see https://github.com/arduino/Arduino/blob/master/build/shared/manpage.adoc
*/
public async _build(buildMode: BuildMode, compile: boolean, buildDir?: string): Promise<boolean> {
const dc = DeviceContext.getInstance();
Expand Down Expand Up @@ -315,7 +316,10 @@ export class ArduinoApp {
}

// We always build verbosely but filter the output based on the settings
args.push("--verbose");
args.push("--verbose-build");
if (verbose) {
args.push("--verbose-upload");
}

await vscode.workspace.saveAll(false);

Expand Down Expand Up @@ -377,12 +381,31 @@ export class ArduinoApp {
const stderrcb = (line: string) => {
if (os.platform() === "win32") {
line = line.trim();
if (line.length && !line.startsWith("DEBUG ") && !line.startsWith("TRACE ") && !line.startsWith("INFO ")) {
arduinoChannel.channel.append(`${line}${os.EOL}`);
if (line.length <= 0) {
return;
}
line = `${line}${os.EOL}`;
}
if (!verbose) {
// Don't spill log with spurious info from the backend
// This list could be fetched from a config file to
// accommodate messages of unknown board packages, newer
// backend revisions etc.
const filters = [
/^Picked\sup\sJAVA_TOOL_OPTIONS:\s+/,
/^\d+\d+-\d+-\d+T\d+:\d+:\d+.\d+Z\sINFO\s/,
/^\d+\d+-\d+-\d+T\d+:\d+:\d+.\d+Z\sWARN\s/,
/^DEBUG\s+/,
/^TRACE\s+/,
/^INFO\s+/,
];
for (const f of filters) {
if (line.match(f)) {
return;
}
}
} else {
arduinoChannel.channel.append(line);
}
arduinoChannel.channel.append(line);
}

return await util.spawn(
Expand Down

0 comments on commit 30210dc

Please sign in to comment.