Skip to content

Commit 9dfe361

Browse files
committed
feat: use logs for displaying index files generation
1 parent 7ed557c commit 9dfe361

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/index_generator/source.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,15 @@ export class IndexGeneratorSource {
252252
}
253253

254254
/**
255-
* Create a log action for tracking file generation progress
255+
* Displays the log message after generating the index file
256256
*
257257
* @example
258-
* const action = this.#createLogAction()
258+
* const startTime = process.hrtime()
259259
* // ... perform operations
260-
* action.displayDuration().succeeded()
260+
* this.#logCreation(startTime)
261261
*/
262-
#createLogAction() {
263-
return this.#cliLogger.action(`create ${this.#config.output}`)
262+
#logCreation(startTime: [number, number]) {
263+
this.#cliLogger.info(`created ${this.#config.output}`, { startTime })
264264
}
265265

266266
/**
@@ -275,9 +275,9 @@ export class IndexGeneratorSource {
275275
const added = this.#vfs.add(filePath)
276276
if (added) {
277277
debug('file added, re-generating "%s" index', this.name)
278-
const action = this.#createLogAction()
278+
const startTime = process.hrtime()
279279
await this.#generateOutput()
280-
action.displayDuration().succeeded()
280+
this.#logCreation(startTime)
281281
}
282282
}
283283

@@ -293,9 +293,9 @@ export class IndexGeneratorSource {
293293
const removed = this.#vfs.remove(filePath)
294294
if (removed) {
295295
debug('file removed, re-generating "%s" index', this.name)
296-
const action = this.#createLogAction()
296+
const startTime = process.hrtime()
297297
await this.#generateOutput()
298-
action.displayDuration().succeeded()
298+
this.#logCreation(startTime)
299299
}
300300
}
301301

@@ -306,9 +306,9 @@ export class IndexGeneratorSource {
306306
* the configuration, and writes the generated index file to disk.
307307
*/
308308
async generate() {
309-
const action = this.#createLogAction()
309+
const startTime = process.hrtime()
310310
await this.#vfs.scan()
311311
await this.#generateOutput()
312-
action.displayDuration().succeeded()
312+
this.#logCreation(startTime)
313313
}
314314
}

0 commit comments

Comments
 (0)