Skip to content

Commit 0e5c2ad

Browse files
Fixed PR comments
1 parent 047668e commit 0e5c2ad

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/core/module-exporter.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ export class ModuleExporter {
1616

1717
async exportModule(moduleName: Modules, options: ExportOptions = {}): Promise<void> {
1818
try {
19-
log.info(`Exporting module: ${moduleName}`, this.logContext);
20-
log.debug(`Building export command for module: ${moduleName}`, this.logContext);
19+
const moduleLogContext = createLogContext(this.exportQueryConfig, moduleName);
20+
log.info(`Exporting module: ${moduleName}`, moduleLogContext);
21+
log.debug(`Building export command for module: ${moduleName}`, moduleLogContext);
2122

2223
// Build command arguments
2324
const cmd = this.buildExportCommand(moduleName, options);
@@ -28,7 +29,7 @@ export class ModuleExporter {
2829

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

3334
// Read the exported data
3435
// const data = await this.readExportedData(moduleName, options);
@@ -38,9 +39,10 @@ export class ModuleExporter {
3839
}
3940

4041
// success message
41-
log.success(`Successfully exported ${moduleName}`, this.logContext);
42+
log.success(`Successfully exported ${moduleName}`, moduleLogContext);
4243
} catch (error) {
43-
log.error(`Failed to export ${moduleName}: ${formatError(error)}`, this.logContext);
44+
const moduleLogContext = createLogContext(this.exportQueryConfig, moduleName);
45+
log.error(`Failed to export ${moduleName}: ${formatError(error)}`, moduleLogContext);
4446
throw error;
4547
}
4648
}

src/utils/logger.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,10 @@ export interface LogContext {
183183
/**
184184
* Creates a context object for logging from QueryExportConfig
185185
*/
186-
export function createLogContext(config: QueryExportConfig): LogContext {
186+
export function createLogContext(config: QueryExportConfig, moduleName?: string): LogContext {
187187
return {
188188
command: 'cm:stacks:export-query',
189-
module: '',
189+
module: moduleName || '',
190190
email: configHandler.get('email') || '',
191191
sessionId: configHandler.get('sessionId') || '',
192192
apiKey: config.stackApiKey || '',

0 commit comments

Comments
 (0)