mirror of https://github.com/embarklabs/embark.git
fix: fix process logs not showing on errors (#1962)
This commit is contained in:
parent
80df4fa11d
commit
913267b1ce
|
@ -45,6 +45,7 @@ class LogHandler {
|
||||||
*/
|
*/
|
||||||
handleLog(msg, alreadyLogged = false) {
|
handleLog(msg, alreadyLogged = false) {
|
||||||
if (!msg) return;
|
if (!msg) return;
|
||||||
|
msg.logLevel = msg.logLevel || msg.type;
|
||||||
|
|
||||||
// Sometimes messages come in with line breaks, so we need to break them up accordingly.
|
// Sometimes messages come in with line breaks, so we need to break them up accordingly.
|
||||||
let processedMessages = [];
|
let processedMessages = [];
|
||||||
|
@ -86,11 +87,11 @@ class LogHandler {
|
||||||
}
|
}
|
||||||
this.logs.push(log);
|
this.logs.push(log);
|
||||||
this.events.emit(`process-log-${this.processName}`, log);
|
this.events.emit(`process-log-${this.processName}`, log);
|
||||||
if ((this.silent && msg.type !== 'error') || alreadyLogged) {
|
if ((this.silent && msg.logLevel !== 'error') || alreadyLogged) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.logger[msg.type]) {
|
if (this.logger[msg.logLevel]) {
|
||||||
return this.logger[msg.type](normalizeInput(message));
|
return this.logger[msg.logLevel](normalizeInput(message));
|
||||||
}
|
}
|
||||||
this.logger.debug(normalizeInput(message));
|
this.logger.debug(normalizeInput(message));
|
||||||
});
|
});
|
||||||
|
|
|
@ -61,10 +61,15 @@ class EmbarkController {
|
||||||
engine.registerModuleGroup("blockchain");
|
engine.registerModuleGroup("blockchain");
|
||||||
|
|
||||||
engine.startEngine(async () => {
|
engine.startEngine(async () => {
|
||||||
const alreadyStarted = await engine.events.request2("blockchain:node:start", Object.assign(engine.config.blockchainConfig, {isStandalone: true}));
|
try {
|
||||||
if (alreadyStarted) {
|
const alreadyStarted = await engine.events.request2("blockchain:node:start", Object.assign(engine.config.blockchainConfig, {isStandalone: true}));
|
||||||
engine.logger.warn(__('Blockchain process already started. No need to run `embark blockchain`'));
|
if (alreadyStarted) {
|
||||||
process.exit(0);
|
engine.logger.warn(__('Blockchain process already started. No need to run `embark blockchain`'));
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
engine.logger.error(e);
|
||||||
|
process.exit(1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -59,7 +59,7 @@ class Blockchain {
|
||||||
}
|
}
|
||||||
const clientFunctions = this.blockchainNodes[clientName];
|
const clientFunctions = this.blockchainNodes[clientName];
|
||||||
if (!clientFunctions) {
|
if (!clientFunctions) {
|
||||||
return cb(__("Client %s not found", clientName));
|
return cb(__("Client %s not found in registered plugins", clientName));
|
||||||
}
|
}
|
||||||
|
|
||||||
let onStart = () => {
|
let onStart = () => {
|
||||||
|
@ -91,7 +91,7 @@ class Blockchain {
|
||||||
|
|
||||||
const clientFunctions = this.blockchainNodes[clientName];
|
const clientFunctions = this.blockchainNodes[clientName];
|
||||||
if (!clientFunctions) {
|
if (!clientFunctions) {
|
||||||
return cb(__("Client %s not found", clientName));
|
return cb(__("Client %s not found in registered plugins", clientName));
|
||||||
}
|
}
|
||||||
|
|
||||||
clientFunctions.stopFn.apply(clientFunctions, [
|
clientFunctions.stopFn.apply(clientFunctions, [
|
||||||
|
|
|
@ -199,8 +199,8 @@ Blockchain.prototype.run = function () {
|
||||||
}
|
}
|
||||||
], function(err, cmd, args) {
|
], function(err, cmd, args) {
|
||||||
if (err) {
|
if (err) {
|
||||||
self.logger.error(err.message);
|
self.logger.error(err.message || err);
|
||||||
return;
|
process.exit(1);
|
||||||
}
|
}
|
||||||
args = compact(args);
|
args = compact(args);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue