Skip to content

fix: include all log args in the log message #2101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions arduino-ide-extension/src/node/arduino-daemon-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
DisposableCollection,
} from '@theia/core/lib/common/disposable';
import { Event, Emitter } from '@theia/core/lib/common/event';
import { deepClone } from '@theia/core/lib/common/objects';
import { environment } from '@theia/application-package/lib/environment';
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
Expand Down Expand Up @@ -171,7 +172,10 @@ export class ArduinoDaemonImpl
const args = await this.getSpawnArgs();
const cliPath = this.getExecPath();
const ready = new Deferred<{ daemon: ChildProcess; port: string }>();
const options = { shell: true };
const options = {
shell: true,
env: { ...deepClone(process.env), NO_COLOR: String(true) },
};
const daemon = spawn(`"${cliPath}"`, args, options);

// If the process exists right after the daemon gRPC server has started (due to an invalid port, unknown address, TCP port in use, etc.)
Expand Down Expand Up @@ -258,7 +262,7 @@ export class ArduinoDaemonImpl
}

protected onData(message: string): void {
this.logger.info(message);
this.logger.info(message.trim());
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
13 changes: 8 additions & 5 deletions electron/build/patch/backend/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// From the specs: https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html
// "If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used."
const os = require('os');
const util = require('util');
if (os.platform() === 'linux' && !process.env['XDG_CONFIG_HOME']) {
const { join } = require('path');
const home = process.env['HOME'];
Expand All @@ -18,12 +19,14 @@ setup({
appName: 'Arduino IDE',
maxSize: 10 * 1024 * 1024
});
for (const name of ['log', 'trace', 'info', 'warn', 'error']) {
for (const name of ['log', 'trace', 'debug', 'info', 'warn', 'error']) {
const original = console[name];
console[name] = (data => {
original(data);
log(data);
}).bind(console);
console[name] = function () {
const messages = Object.values(arguments);
const message = util.format(...messages)
original(message)
log(message);
}
}

const { BackendApplicationConfigProvider } = require('@theia/core/lib/node/backend-application-config-provider');
Expand Down