Skip to content

Commit 8ff97e6

Browse files
committed
refactor: Adapt shared to modern logs
1 parent 1c8f911 commit 8ff97e6

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

lib/shared.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const sha256File = require('sha256-file');
1212
* @param {Object} serverless
1313
* @return {undefined}
1414
*/
15-
function checkForAndDeleteMaxCacheVersions(options, serverless) {
15+
function checkForAndDeleteMaxCacheVersions({ serverless, options, log }) {
1616
// If we're using the static cache, and we have static cache max versions enabled
1717
if (
1818
options.useStaticCache &&
@@ -42,10 +42,17 @@ function checkForAndDeleteMaxCacheVersions(options, serverless) {
4242
rimraf.sync(files[i]);
4343
items++;
4444
}
45+
4546
// Log the number of cache files flushed
46-
serverless.cli.log(
47-
`Removed ${items} items from cache because of staticCacheMaxVersions`
48-
);
47+
if (log) {
48+
log.info(
49+
`Removed ${items} items from cache because of staticCacheMaxVersions`
50+
);
51+
} else {
52+
serverless.cli.log(
53+
`Removed ${items} items from cache because of staticCacheMaxVersions`
54+
);
55+
}
4956
}
5057
}
5158
}

0 commit comments

Comments
 (0)