fix(embark/logger): fix logs in the dashboard

they were displaying the color as text instead of as a color
This commit is contained in:
Jonathan Rainville 2019-03-11 13:06:40 -04:00 committed by Iuri Matias
parent cba7c85242
commit 88a41e7c28

View File

@ -1,6 +1,7 @@
let blessed = require("neo-blessed");
const REPL = require('./repl.js');
const stream = require('stream');
const util = require('util');
class Monitor {
constructor(_options) {
@ -100,7 +101,15 @@ class Monitor {
}
logEntry() {
this.logText.log(...arguments);
const args = Array.from(arguments);
const color = args[args.length - 1];
args.splice(args.length - 1, 1);
this.logText.log(...args.filter(arg => arg !== undefined && arg !== null).map(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();
}