mirror of https://github.com/embarklabs/embark.git
fix(@embark/dashboard): update dashboard's `logEntry` to match core/logger's `logFunction`
`packages/embark/src/cmd/dashboard/dashboard.js` overwrites the logger instance's `logFunction` method with a method named `logEntry` defined on the class exported from `packages/embark/src/cmd/dashboard/monitor.js`. Update `logEntry` in the same way as `logFunction` was revised in #2184.
This commit is contained in:
parent
5b988ead7a
commit
63831f6110
|
@ -104,16 +104,12 @@ class Monitor {
|
||||||
this.screen.render();
|
this.screen.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
logEntry() {
|
logEntry(args, color) {
|
||||||
const args = Array.from(arguments);
|
args = Array.isArray(args) ? args : [args];
|
||||||
const color = args[args.length - 1];
|
this.logText.log(...(args.filter(arg => arg ?? false).map(arg => {
|
||||||
args.splice(args.length - 1, 1);
|
if (typeof arg === 'object') arg = util.inspect(arg, 2);
|
||||||
this.logText.log(...args.filter(arg => arg !== undefined && arg !== null).map(arg => {
|
return color ? arg[color] : arg;
|
||||||
if (color) {
|
})));
|
||||||
return typeof arg === 'object' ? util.inspect(arg, 2)[color] : arg[color];
|
|
||||||
}
|
|
||||||
return typeof arg === 'object' ? util.inspect(arg, 2) : arg;
|
|
||||||
}));
|
|
||||||
this.screen.render();
|
this.screen.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue