From a6a880c457c0464b4173e66534b1c0f85b4ae9dc Mon Sep 17 00:00:00 2001 From: Dan Janosik Date: Thu, 28 Feb 2019 16:58:24 -0500 Subject: [PATCH] logging cleanup --- app/api/rpcApi.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/api/rpcApi.js b/app/api/rpcApi.js index 9a6abb5..ffd3083 100644 --- a/app/api/rpcApi.js +++ b/app/api/rpcApi.js @@ -355,6 +355,7 @@ function getRpcMethodHelp(methodName) { function getRpcData(cmd) { return new Promise(function(resolve, reject) { + debug(`RPC: ${cmd}`); client.command(cmd, function(err, result, resHeaders) { if (err) { console.log("Error for RPC command '" + cmd + "': " + err); @@ -372,6 +373,7 @@ function getRpcData(cmd) { function getRpcDataWithParams(cmd, params) { return new Promise(function(resolve, reject) { + debug(`RPC: ${cmd}(${params})`); client.command(cmd, params, function(err, result, resHeaders) { if (err) { console.log("Error for RPC command '" + cmd + "': " + err); @@ -390,24 +392,25 @@ function getRpcDataWithParams(cmd, params) { function executeBatchesSequentially(batches, resultFunc) { var batchId = utils.getRandomString(20, 'aA#'); - debug("Starting " + batches.length + "-item batch " + batchId + "..."); + debug(`Starting ${batches.length}-item batch ${batchId}...`); executeBatchesSequentiallyInternal(batchId, batches, 0, [], resultFunc); } function executeBatchesSequentiallyInternal(batchId, batches, currentIndex, accumulatedResults, resultFunc) { if (currentIndex == batches.length) { - debug("Finishing batch " + batchId + "..."); + debug(`Finishing batch ${batchId}...`); resultFunc(accumulatedResults); return; } - debug("Executing item #" + (currentIndex + 1) + " (of " + batches.length + ") for batch " + batchId); + debug(`Executing item #${(currentIndex + 1)} (of ${batches.length}) for batch ${batchId}`); var count = batches[currentIndex].length; + debug(`RPC: ${JSON.stringify(batches[currentIndex])}`); client.command(batches[currentIndex]).then(function(results) { results.forEach((item) => { accumulatedResults.push(item);