Skip to content

Commit 3583ec3

Browse files
Added log.debug
1 parent a5293ed commit 3583ec3

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

src/commands/cm/stacks/export-query.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ export default class ExportQueryCommand extends Command {
8383
}
8484

8585
this.exportDir = sanitizePath(exportQueryConfig.exportDir);
86+
const context = createLogContext(exportQueryConfig);
87+
log.debug('Export configuration setup completed', context);
8688

8789
// Initialize management API client
8890
const managementAPIClient: ContentstackClient = await managementSDKClient(exportQueryConfig);
@@ -95,12 +97,14 @@ export default class ExportQueryCommand extends Command {
9597

9698
// Setup branches (validate branch or set default to 'main')
9799
await setupBranches(exportQueryConfig, stackAPIClient);
100+
log.debug('Branch configuration setup completed', context);
98101

99102
// Initialize and run query export
103+
log.debug('Starting query exporter', context);
100104
const queryExporter = new QueryExporter(managementAPIClient, exportQueryConfig);
101105
await queryExporter.execute();
106+
log.debug('Query exporter completed successfully', context);
102107

103-
const context = createLogContext(exportQueryConfig);
104108
log.info('Query-based export completed successfully!', context);
105109
log.info(`Export files saved to: ${this.exportDir}`, context);
106110
} catch (error) {

src/core/module-exporter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export class ModuleExporter {
1717
async exportModule(moduleName: Modules, options: ExportOptions = {}): Promise<void> {
1818
try {
1919
log.info(`Exporting module: ${moduleName}`, this.logContext);
20+
log.debug(`Building export command for module: ${moduleName}`, this.logContext);
2021

2122
// Build command arguments
2223
const cmd = this.buildExportCommand(moduleName, options);
@@ -27,6 +28,7 @@ export class ModuleExporter {
2728

2829
// Create export command instance
2930
await ExportCommand.run(cmd);
31+
log.debug(`Export command completed for module: ${moduleName}`, this.logContext);
3032

3133
// Read the exported data
3234
// const data = await this.readExportedData(moduleName, options);

src/core/query-executor.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export class QueryExporter {
3333
log.info('Starting query-based export...', this.logContext);
3434

3535
// Step 1: Parse and validate query
36+
log.debug('Parsing and validating query', this.logContext);
3637
const parsedQuery = await this.queryParser.parse(this.exportQueryConfig.query);
3738
log.info('Query parsed and validated successfully', this.logContext);
3839

@@ -56,10 +57,13 @@ export class QueryExporter {
5657
}
5758

5859
// Step 5: export other content types which are referenced in previous step
60+
log.debug('Starting referenced content types export', this.logContext);
5961
await this.exportReferencedContentTypes();
6062
// Step 6: export dependent modules global fields, extensions, taxonomies
63+
log.debug('Starting dependent modules export', this.logContext);
6164
await this.exportDependentModules();
6265
// Step 7: export content modules entries, assets
66+
log.debug('Starting content modules export', this.logContext);
6367
await this.exportContentModules();
6468
// Step 9: export all other modules
6569

@@ -76,6 +80,7 @@ export class QueryExporter {
7680
}
7781

7882
private async exportQueriedModule(parsedQuery: any): Promise<void> {
83+
log.debug('Starting queried module export', this.logContext);
7984
for (const [moduleName] of Object.entries(parsedQuery.modules)) {
8085
const module = moduleName as Modules;
8186

@@ -88,6 +93,7 @@ export class QueryExporter {
8893
// Export the queried module
8994
await this.moduleExporter.exportModule(module, { query: parsedQuery });
9095
}
96+
log.debug('Queried module export completed', this.logContext);
9197
}
9298

9399
private async exportReferencedContentTypes(): Promise<void> {
@@ -120,6 +126,7 @@ export class QueryExporter {
120126
// Step 3: Process batches until no new references are found
121127
while (currentBatch.length > 0 && iterationCount < this.exportQueryConfig.maxCTReferenceDepth) {
122128
iterationCount++;
129+
log.debug(`Processing referenced content types iteration ${iterationCount}`, this.logContext);
123130
currentBatch.forEach((ct: any) => exportedContentTypeUIDs.add(ct.uid));
124131
// Extract referenced content types from current batch
125132
const referencedUIDs = await referencedHandler.extractReferencedContentTypes(currentBatch);
@@ -178,6 +185,7 @@ export class QueryExporter {
178185

179186
// Extract dependencies from all exported content types
180187
const dependencies = await dependenciesHandler.extractDependencies();
188+
log.debug('Dependencies extracted successfully', this.logContext);
181189

182190
// Export Global Fields
183191
if (dependencies.globalFields.size > 0) {
@@ -303,6 +311,7 @@ export class QueryExporter {
303311
const assetHandler = new AssetReferenceHandler(this.exportQueryConfig);
304312

305313
// Extract referenced asset UIDs from all entries
314+
log.debug('Extracting referenced assets from entries', this.logContext);
306315
const assetUIDs = assetHandler.extractReferencedAssets();
307316

308317
if (assetUIDs.length > 0) {

0 commit comments

Comments
 (0)