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

Commit 30210dc

Browse files
elektronikworkshopadiazulay
authored andcommitted
Make upload verbosity be conditional and extend filtering
* Building always verbosely but upload only verbosely when requested * Filtering of spurious messages now with regex list and for all platforms
1 parent fed508f commit 30210dc

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

src/arduino/arduino.ts

+28-5
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ export class ArduinoApp {
196196
* manages the build state.
197197
* @param buildMode See build()
198198
* @param buildDir See build()
199+
* @see https://github.com/arduino/Arduino/blob/master/build/shared/manpage.adoc
199200
*/
200201
public async _build(buildMode: BuildMode, compile: boolean, buildDir?: string): Promise<boolean> {
201202
const dc = DeviceContext.getInstance();
@@ -315,7 +316,10 @@ export class ArduinoApp {
315316
}
316317

317318
// We always build verbosely but filter the output based on the settings
318-
args.push("--verbose");
319+
args.push("--verbose-build");
320+
if (verbose) {
321+
args.push("--verbose-upload");
322+
}
319323

320324
await vscode.workspace.saveAll(false);
321325

@@ -377,12 +381,31 @@ export class ArduinoApp {
377381
const stderrcb = (line: string) => {
378382
if (os.platform() === "win32") {
379383
line = line.trim();
380-
if (line.length && !line.startsWith("DEBUG ") && !line.startsWith("TRACE ") && !line.startsWith("INFO ")) {
381-
arduinoChannel.channel.append(`${line}${os.EOL}`);
384+
if (line.length <= 0) {
385+
return;
386+
}
387+
line = `${line}${os.EOL}`;
388+
}
389+
if (!verbose) {
390+
// Don't spill log with spurious info from the backend
391+
// This list could be fetched from a config file to
392+
// accommodate messages of unknown board packages, newer
393+
// backend revisions etc.
394+
const filters = [
395+
/^Picked\sup\sJAVA_TOOL_OPTIONS:\s+/,
396+
/^\d+\d+-\d+-\d+T\d+:\d+:\d+.\d+Z\sINFO\s/,
397+
/^\d+\d+-\d+-\d+T\d+:\d+:\d+.\d+Z\sWARN\s/,
398+
/^DEBUG\s+/,
399+
/^TRACE\s+/,
400+
/^INFO\s+/,
401+
];
402+
for (const f of filters) {
403+
if (line.match(f)) {
404+
return;
405+
}
382406
}
383-
} else {
384-
arduinoChannel.channel.append(line);
385407
}
408+
arduinoChannel.channel.append(line);
386409
}
387410

388411
return await util.spawn(

0 commit comments

Comments
 (0)