Skip to content

Commit

Permalink
fix(logger): include debug messages in the log file
Browse files Browse the repository at this point in the history
 - `debug` messages logged by the Theia logger were not forwarded to the
file logger.
 - Instead of logging the first argument only, let Node.js generate a
string message from every args, and log the final string message to the
console and the file.

Signed-off-by: Akos Kitta <[email protected]>
  • Loading branch information
Akos Kitta committed Jun 23, 2023
1 parent d79bc0d commit 5955d44
Showing 1 changed file with 8 additions and 5 deletions.
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

0 comments on commit 5955d44

Please sign in to comment.