@@ -90,8 +90,7 @@ module.exports.register = function ({ playbook, config = {} }) {
90
90
} )
91
91
this . once ( 'beforePublish' , async ( ) => {
92
92
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 )
95
94
}
96
95
} )
97
96
}
@@ -129,7 +128,7 @@ function createCachedCollectorConfig (scanDir, cacheDir) {
129
128
]
130
129
}
131
130
132
- const zip = async function ( fs , src , destination ) {
131
+ const zip = async function ( fs , logger , src , destination ) {
133
132
const path = require ( 'path' )
134
133
const destParent = path . dirname ( destination )
135
134
if ( ! fs . existsSync ( destParent ) ) {
@@ -142,15 +141,15 @@ const zip = async function (fs, src, destination) {
142
141
// listen for all archive data to be written
143
142
// 'close' event is fired only when a file descriptor is involved
144
143
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.' )
147
146
} )
148
147
149
148
// This event is fired when the data source is drained no matter what was the data source.
150
149
// It is not part of this library but rather from the NodeJS Stream API.
151
150
// @see : https://nodejs.org/api/stream.html#stream_event_end
152
151
output . on ( 'end' , function ( ) {
153
- console . log ( 'Data has been drained' )
152
+ logger . info ( 'Data has been drained' )
154
153
} )
155
154
156
155
// good practice to catch warnings (ie stat failures and other non-blocking errors)
@@ -175,5 +174,5 @@ const zip = async function (fs, src, destination) {
175
174
176
175
await archive . finalize ( )
177
176
178
- console . log ( `Saving ${ src } into ${ destination } ` )
177
+ logger . info ( `Saving ${ src } into ${ destination } ` )
179
178
}
0 commit comments