refactor(CLI): Adapt logInfo to modern logs

This commit is contained in:
Piotr Grzesik 2021-10-11 14:12:25 +02:00
parent d43298d25b
commit 771f99b18d

View File

@ -1,6 +1,7 @@
'use strict';
const logInfo = require('./Error').logInfo;
const { log } = require('@serverless/utils/log');
const constants = {
pending: 'pending',
@ -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() {
@ -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();
}