From 5b7a68b70a37cd4a5bd441023b74e6cbf21abbf6 Mon Sep 17 00:00:00 2001 From: Peter van Gulik Date: Thu, 22 Aug 2024 16:06:14 +0200 Subject: [PATCH] chore: improve logging consistency during export --- .../vlocity-deploy/src/export/datapackExpander.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/vlocity-deploy/src/export/datapackExpander.ts b/packages/vlocity-deploy/src/export/datapackExpander.ts index c2591f0f..7d0d0a17 100644 --- a/packages/vlocity-deploy/src/export/datapackExpander.ts +++ b/packages/vlocity-deploy/src/export/datapackExpander.ts @@ -68,8 +68,7 @@ export class DatapackExpander { scope?: string; } ): DatapackExpandResult { - this.logger.info(`Expanding: ${datapack.VlocityRecordSourceKey}`); - const timer = new Timer(); + this.logger.verbose(`Expand ${datapack.VlocityRecordSourceKey}`); const itemRef = { objectType: datapack.VlocityRecordSObjectType, @@ -124,7 +123,7 @@ export class DatapackExpander { } files.addFile(DatapackExpander.datapackFileName, data); - this.logger.info(`Expanded ${datapack.VlocityRecordSourceKey} - ${timer.toString("ms")}`); + this.logger.info(`Expanded ${datapack.VlocityRecordSourceKey} (${files.count})`); return { objectType: datapack.VlocityRecordSObjectType, @@ -181,6 +180,14 @@ export class DatapackExpander { class DatapackFiles { private files: Record = {}; + public get count() { + return Object.keys(this.files).length; + } + + public get size() { + return Object.values(this.files).reduce((size, data) => size + (Buffer.isBuffer(data) ? data.length : Buffer.byteLength(data)), 0); + } + constructor( public readonly filePrefix: string, public readonly folder: string,