Skip to content

Commit 63831f6

Browse files
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.
1 parent 5b988ea commit 63831f6

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

packages/embark/src/cmd/dashboard/monitor.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,12 @@ class Monitor {
104104
this.screen.render();
105105
}
106106

107-
logEntry() {
108-
const args = Array.from(arguments);
109-
const color = args[args.length - 1];
110-
args.splice(args.length - 1, 1);
111-
this.logText.log(...args.filter(arg => arg !== undefined && arg !== null).map(arg => {
112-
if (color) {
113-
return typeof arg === 'object' ? util.inspect(arg, 2)[color] : arg[color];
114-
}
115-
return typeof arg === 'object' ? util.inspect(arg, 2) : arg;
116-
}));
107+
logEntry(args, color) {
108+
args = Array.isArray(args) ? args : [args];
109+
this.logText.log(...(args.filter(arg => arg ?? false).map(arg => {
110+
if (typeof arg === 'object') arg = util.inspect(arg, 2);
111+
return color ? arg[color] : arg;
112+
})));
117113
this.screen.render();
118114
}
119115

0 commit comments

Comments
 (0)