diff --git a/lib/inject-collector-cache-config-extension.js b/lib/inject-collector-cache-config-extension.js index fe0cf3d..5cb1760 100644 --- a/lib/inject-collector-cache-config-extension.js +++ b/lib/inject-collector-cache-config-extension.js @@ -90,8 +90,7 @@ module.exports.register = function ({ playbook, config = {} }) { }) this.once('beforePublish', async () => { for (const info of zipInfo) { - console.log(JSON.stringify(info)) - await zip(fs, info.cacheDir, info.zipCacheFile) + await zip(fs, logger, info.cacheDir, info.zipCacheFile) } }) } @@ -129,7 +128,7 @@ function createCachedCollectorConfig (scanDir, cacheDir) { ] } -const zip = async function (fs, src, destination) { +const zip = async function (fs,logger, src, destination) { const path = require('path') const destParent = path.dirname(destination) if (!fs.existsSync(destParent)) { @@ -142,15 +141,15 @@ const zip = async function (fs, src, destination) { // listen for all archive data to be written // 'close' event is fired only when a file descriptor is involved output.on('close', function () { - console.log(archive.pointer() + ' total bytes') - console.log('archiver has been finalized and the output file descriptor has closed.') + logger.info(archive.pointer() + ' total bytes') + logger.info('archiver has been finalized and the output file descriptor has closed.') }) // This event is fired when the data source is drained no matter what was the data source. // It is not part of this library but rather from the NodeJS Stream API. // @see: https://nodejs.org/api/stream.html#stream_event_end output.on('end', function () { - console.log('Data has been drained') + logger.info('Data has been drained') }) // good practice to catch warnings (ie stat failures and other non-blocking errors) @@ -175,5 +174,5 @@ const zip = async function (fs, src, destination) { await archive.finalize() - console.log(`Saving ${src} into ${destination}`) + logger.info(`Saving ${src} into ${destination}`) }