Skip to content

Commit 5955d44

Browse files
author
Akos Kitta
committed
fix(logger): include debug messages in the log file
- `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]>
1 parent d79bc0d commit 5955d44

File tree

1 file changed

+8
-5
lines changed
  • electron/build/patch/backend

1 file changed

+8
-5
lines changed

Diff for: electron/build/patch/backend/main.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// From the specs: https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html
77
// "If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used."
88
const os = require('os');
9+
const util = require('util');
910
if (os.platform() === 'linux' && !process.env['XDG_CONFIG_HOME']) {
1011
const { join } = require('path');
1112
const home = process.env['HOME'];
@@ -18,12 +19,14 @@ setup({
1819
appName: 'Arduino IDE',
1920
maxSize: 10 * 1024 * 1024
2021
});
21-
for (const name of ['log', 'trace', 'info', 'warn', 'error']) {
22+
for (const name of ['log', 'trace', 'debug', 'info', 'warn', 'error']) {
2223
const original = console[name];
23-
console[name] = (data => {
24-
original(data);
25-
log(data);
26-
}).bind(console);
24+
console[name] = function () {
25+
const messages = Object.values(arguments);
26+
const message = util.format(...messages)
27+
original(message)
28+
log(message);
29+
}
2730
}
2831

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

0 commit comments

Comments
 (0)