mirror of https://github.com/embarklabs/embark.git
hide logs for on Deploy if silent
This commit is contained in:
parent
2edd45ef55
commit
ea0d846012
|
@ -63,10 +63,11 @@ class SpecialConfigs {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
runOnDeployCode(onDeployCode, callback) {
|
runOnDeployCode(onDeployCode, callback, silent) {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
const logFunction = silent ? self.logger.trace.bind(self.logger) : self.logger.info.bind(self.logger);
|
||||||
async.each(onDeployCode, (cmd, eachCb) => {
|
async.each(onDeployCode, (cmd, eachCb) => {
|
||||||
self.logger.info("==== executing: " + cmd);
|
logFunction("==== executing: " + cmd);
|
||||||
self.events.request('runcode:eval', cmd, (err) => {
|
self.events.request('runcode:eval', cmd, (err) => {
|
||||||
if (err && err.message.indexOf("invalid opcode") >= 0) {
|
if (err && err.message.indexOf("invalid opcode") >= 0) {
|
||||||
self.logger.error('the transaction was rejected; this usually happens due to a throw or a require, it can also happen due to an invalid operation');
|
self.logger.error('the transaction was rejected; this usually happens due to a throw or a require, it can also happen due to an invalid operation');
|
||||||
|
@ -85,8 +86,9 @@ class SpecialConfigs {
|
||||||
if (!contract.onDeploy) {
|
if (!contract.onDeploy) {
|
||||||
return cb();
|
return cb();
|
||||||
}
|
}
|
||||||
|
if (!contract.silent) {
|
||||||
self.logger.info(__('executing onDeploy commands'));
|
self.logger.info(__('executing onDeploy commands'));
|
||||||
|
}
|
||||||
|
|
||||||
let onDeployCmds = contract.onDeploy;
|
let onDeployCmds = contract.onDeploy;
|
||||||
|
|
||||||
|
@ -97,7 +99,7 @@ class SpecialConfigs {
|
||||||
return cb(new Error("error running onDeploy for " + contract.className.cyan));
|
return cb(new Error("error running onDeploy for " + contract.className.cyan));
|
||||||
}
|
}
|
||||||
|
|
||||||
self.runOnDeployCode(onDeployCode, cb);
|
self.runOnDeployCode(onDeployCode, cb, contract.silent);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue