mirror of https://github.com/embarklabs/embark.git
feat(console): print console results as log so cockpit gets it
This commit is contained in:
parent
e3396417da
commit
57cd6d3da1
|
@ -342,7 +342,8 @@ class EmbarkController {
|
||||||
new REPL({
|
new REPL({
|
||||||
events: engine.events,
|
events: engine.events,
|
||||||
env: engine.env,
|
env: engine.env,
|
||||||
ipc: engine.ipc
|
ipc: engine.ipc,
|
||||||
|
logger: engine.logger
|
||||||
}).start(callback);
|
}).start(callback);
|
||||||
}
|
}
|
||||||
], function (err, _result) {
|
], function (err, _result) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ class Dashboard {
|
||||||
start(done) {
|
start(done) {
|
||||||
let monitor;
|
let monitor;
|
||||||
|
|
||||||
monitor = new Monitor({env: this.env, events: this.events, version: this.version, ipc: this.ipc});
|
monitor = new Monitor({env: this.env, events: this.events, version: this.version, ipc: this.ipc, logger: this.logger});
|
||||||
this.logger.logFunction = monitor.logEntry;
|
this.logger.logFunction = monitor.logEntry;
|
||||||
let plugin = this.plugins.createPlugin('dashboard', {});
|
let plugin = this.plugins.createPlugin('dashboard', {});
|
||||||
plugin.registerAPICall(
|
plugin.registerAPICall(
|
||||||
|
|
|
@ -11,6 +11,7 @@ class Monitor {
|
||||||
this.color = options.color || "green";
|
this.color = options.color || "green";
|
||||||
this.minimal = options.minimal || false;
|
this.minimal = options.minimal || false;
|
||||||
this.ipc = options.ipc;
|
this.ipc = options.ipc;
|
||||||
|
this.logger = options.logger;
|
||||||
|
|
||||||
this.screen = blessed.screen({
|
this.screen = blessed.screen({
|
||||||
smartCSR: true,
|
smartCSR: true,
|
||||||
|
@ -52,6 +53,7 @@ class Monitor {
|
||||||
this.repl = new REPL({
|
this.repl = new REPL({
|
||||||
events: this.events,
|
events: this.events,
|
||||||
env: this.env,
|
env: this.env,
|
||||||
|
logger: this.logger,
|
||||||
inputStream: this.terminalReadableStream,
|
inputStream: this.terminalReadableStream,
|
||||||
outputStream: terminalWritableStream,
|
outputStream: terminalWritableStream,
|
||||||
logText: this.logText,
|
logText: this.logText,
|
||||||
|
|
|
@ -9,6 +9,7 @@ class REPL {
|
||||||
this.outputStream = options.outputStream || process.stdout;
|
this.outputStream = options.outputStream || process.stdout;
|
||||||
this.logText = options.logText;
|
this.logText = options.logText;
|
||||||
this.ipc = options.ipc;
|
this.ipc = options.ipc;
|
||||||
|
this.logger = options.logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
addHistory(cmd) {
|
addHistory(cmd) {
|
||||||
|
@ -18,9 +19,9 @@ class REPL {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enhancedEval(cmd, context, filename, callback) {
|
enhancedEval(cmd, _context, _filename, _callback) {
|
||||||
this.events.request('console:executeCmd', cmd.trim(), function (err, message) {
|
this.events.request('console:executeCmd', cmd.trim(), (err, message) => {
|
||||||
callback(err, message === undefined ? '' : message); // This way, we don't print undefined
|
this.logger.info(message === undefined ? '' : message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue