Skip to content

Commit

Permalink
chore: improve logging consistency during export
Browse files Browse the repository at this point in the history
  • Loading branch information
Codeneos committed Aug 22, 2024
1 parent ef5eb9d commit 5b7a68b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/vlocity-deploy/src/export/datapackExpander.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -181,6 +180,14 @@ export class DatapackExpander {
class DatapackFiles {
private files: Record<string, Buffer | string> = {};

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,
Expand Down

0 comments on commit 5b7a68b

Please sign in to comment.