From ea0d846012764bcfe0fc0b0efc379ed4f6148fb5 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Tue, 7 Aug 2018 16:04:26 -0400 Subject: [PATCH] hide logs for on Deploy if silent --- lib/modules/specialconfigs/index.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/modules/specialconfigs/index.js b/lib/modules/specialconfigs/index.js index 0f6dcb91..154bbda3 100644 --- a/lib/modules/specialconfigs/index.js +++ b/lib/modules/specialconfigs/index.js @@ -63,10 +63,11 @@ class SpecialConfigs { }); } - runOnDeployCode(onDeployCode, callback) { + runOnDeployCode(onDeployCode, callback, silent) { const self = this; + const logFunction = silent ? self.logger.trace.bind(self.logger) : self.logger.info.bind(self.logger); async.each(onDeployCode, (cmd, eachCb) => { - self.logger.info("==== executing: " + cmd); + logFunction("==== executing: " + cmd); self.events.request('runcode:eval', cmd, (err) => { 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'); @@ -85,8 +86,9 @@ class SpecialConfigs { if (!contract.onDeploy) { return cb(); } - - self.logger.info(__('executing onDeploy commands')); + if (!contract.silent) { + self.logger.info(__('executing onDeploy commands')); + } let onDeployCmds = contract.onDeploy; @@ -97,7 +99,7 @@ class SpecialConfigs { return cb(new Error("error running onDeploy for " + contract.className.cyan)); } - self.runOnDeployCode(onDeployCode, cb); + self.runOnDeployCode(onDeployCode, cb, contract.silent); }); }); }