Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit ebca279

Browse files
authored
[0.19.x] logging improvements (#4522)
Signed-off-by: Dave Kelsey <d_kelsey@uk.ibm.com>
1 parent 84aeffe commit ebca279

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

packages/composer-runtime-hlfv1/lib/nodeutils.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,13 @@ class NodeUtils {
3636
const t0 = Date.now();
3737

3838
let results = [];
39-
let logResults = [];
4039
let res = {done: false};
4140
while (!res.done) {
42-
res = await iterator.next(); //TODO: should we catch an error or just let it flow up the stack
41+
res = await iterator.next();
4342
if (res && res.value && res.value.value) {
4443
let val = res.value.value.toString('utf8');
4544
if (val.length > 0) {
4645
results.push(JSON.parse(val));
47-
logResults.push(val);
4846
}
4947
}
5048
if (res && res.done) {
@@ -57,7 +55,7 @@ class NodeUtils {
5755
const warnMsg = 'Failure to close iterator. ' + err;
5856
LOG.warn(warnMsg);
5957
}
60-
LOG.exit(method, logResults);
58+
LOG.exit(method);
6159
LOG.verbose('@PERF ' + method, 'Total (ms) duration: ' + (Date.now() - t0).toFixed(2));
6260
return results;
6361
}
@@ -78,7 +76,6 @@ class NodeUtils {
7876
const t0 = Date.now();
7977

8078
let results = [];
81-
let logResults = [];
8279
let res = {done: false};
8380
while (!res.done) {
8481
res = await iterator.next(); //TODO: should we catch an error or just let it flow up the stack
@@ -96,7 +93,7 @@ class NodeUtils {
9693
const warnMsg = 'Failure to close iterator. ' + err;
9794
LOG.warn(warnMsg);
9895
}
99-
LOG.exit(method, logResults);
96+
LOG.exit(method);
10097
LOG.verbose('@PERF ' + method, 'Total (ms) duration: ' + (Date.now() - t0).toFixed(2));
10198
return results;
10299
}

packages/composer-runtime/lib/accesscontroller.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,8 @@ class AccessController {
9494
// enforcement is not enabled.
9595
let participant = this.participant;
9696
if (!participant) {
97-
LOG.debug(method, 'No participant');
97+
LOG.verbose('@PERF ' + method, 'NO PARTICIPANT: Total (ms) duration: ' + (Date.now() - t0).toFixed(2));
9898
LOG.exit(method);
99-
LOG.verbose('@PERF ' + method, 'Total (ms) duration: ' + (Date.now() - t0).toFixed(2));
10099
return Promise.resolve();
101100
}
102101

@@ -107,9 +106,8 @@ class AccessController {
107106
// enforcement is not enabled.
108107
let aclManager = this.context.getAclManager();
109108
if (!aclManager.getAclFile()) {
110-
LOG.debug(method, 'No ACL file');
109+
LOG.verbose('@PERF ' + method, 'NO ACL FILE: Total (ms) duration: ' + (Date.now() - t0).toFixed(2));
111110
LOG.exit(method);
112-
LOG.verbose('@PERF ' + method, 'Total (ms) duration: ' + (Date.now() - t0).toFixed(2));
113111
return Promise.resolve();
114112
}
115113

0 commit comments

Comments
 (0)