Skip to content

Commit

Permalink
refactor(CLI): Adapt logInfo to modern logs
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrzesik committed Oct 11, 2021
1 parent d43298d commit 771f99b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/classes/PromiseTracker.js
@@ -1,6 +1,7 @@
'use strict';

const logInfo = require('./Error').logInfo;
const { log } = require('@serverless/utils/log');

const constants = {
pending: 'pending',
Expand Down Expand Up @@ -38,6 +39,19 @@ class PromiseTracker {
])
.join('\n ')
);
log.info(
[
'############################################################################################',
`# ${delta}: ${this.getSettled().length} of ${this.getAll().length} promises have settled`,
`# ${delta}: ${pending.length} are taking longer than expected:`,
]
.concat(pending.map((promise) => `# ${delta}: ${promise.waitList}`))
.concat([
'# This can result from latent connections but may represent a cyclic variable dependency',
'##########################################################################################',
])
.join('\n ')
);
this.reported = true;
}
stop() {
Expand All @@ -54,6 +68,17 @@ class PromiseTracker {
'##########################################################################################',
].join('\n ')
);
log.info(
[
'############################################################################################',
`# Completed after ${Date.now() - this.startTime}ms`,
`# ${this.getAll().length} promises are in the following states:`,
`# ${constants.resolved}: ${this.getResolved().length}`,
`# ${constants.rejected}: ${this.getRejected().length}`,
`# ${constants.pending}: ${this.getPending().length}`,
'##########################################################################################',
].join('\n ')
);
}
this.reset();
}
Expand Down

0 comments on commit 771f99b

Please sign in to comment.