@@ -90,8 +90,7 @@ module.exports.register = function ({ playbook, config = {} }) {
9090 } )
9191 this . once ( 'beforePublish' , async ( ) => {
9292 for ( const info of zipInfo ) {
93- console . log ( JSON . stringify ( info ) )
94- await zip ( fs , info . cacheDir , info . zipCacheFile )
93+ await zip ( fs , logger , info . cacheDir , info . zipCacheFile )
9594 }
9695 } )
9796}
@@ -129,7 +128,7 @@ function createCachedCollectorConfig (scanDir, cacheDir) {
129128 ]
130129}
131130
132- const zip = async function ( fs , src , destination ) {
131+ const zip = async function ( fs , logger , src , destination ) {
133132 const path = require ( 'path' )
134133 const destParent = path . dirname ( destination )
135134 if ( ! fs . existsSync ( destParent ) ) {
@@ -142,15 +141,15 @@ const zip = async function (fs, src, destination) {
142141 // listen for all archive data to be written
143142 // 'close' event is fired only when a file descriptor is involved
144143 output . on ( 'close' , function ( ) {
145- console . log ( archive . pointer ( ) + ' total bytes' )
146- console . log ( 'archiver has been finalized and the output file descriptor has closed.' )
144+ logger . info ( archive . pointer ( ) + ' total bytes' )
145+ logger . info ( 'archiver has been finalized and the output file descriptor has closed.' )
147146 } )
148147
149148 // This event is fired when the data source is drained no matter what was the data source.
150149 // It is not part of this library but rather from the NodeJS Stream API.
151150 // @see : https://nodejs.org/api/stream.html#stream_event_end
152151 output . on ( 'end' , function ( ) {
153- console . log ( 'Data has been drained' )
152+ logger . info ( 'Data has been drained' )
154153 } )
155154
156155 // good practice to catch warnings (ie stat failures and other non-blocking errors)
@@ -175,5 +174,5 @@ const zip = async function (fs, src, destination) {
175174
176175 await archive . finalize ( )
177176
178- console . log ( `Saving ${ src } into ${ destination } ` )
177+ logger . info ( `Saving ${ src } into ${ destination } ` )
179178}
0 commit comments