Skip to content

Commit

Permalink
Merge pull request #1289 from contentstack/bugfix/CS-43741
Browse files Browse the repository at this point in the history
CS-43741-handled why logs where not created in mentioned path
  • Loading branch information
cs-raj authored Feb 12, 2024
2 parents 160c00d + 75d82e4 commit d2597ee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
10 changes: 2 additions & 8 deletions packages/contentstack-export/src/commands/cm/stacks/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default class ExportCommand extends Command {
static aliases: string[] = ['cm:export'];

async run(): Promise<void> {
let exportDir: string;
let exportDir: string = path.join(process.cwd(), 'logs');
try {
const { flags } = await this.parse(ExportCommand);
let exportConfig = await setupExportConfig(flags);
Expand All @@ -115,13 +115,7 @@ export default class ExportCommand extends Command {
log(exportConfig, `The log has been stored at '${path.join(exportDir, 'logs', 'export')}'`, 'success');
} catch (error) {
log({ data: exportDir } as ExportConfig, `Failed to export stack content - ${formatError(error)}`, 'error');
log(
{ data: exportDir } as ExportConfig,
`The log has been stored at ${
exportDir ? path.join(exportDir, 'logs', 'export') : path.join(__dirname, 'logs')
}`,
'info',
);
log({ data: exportDir } as ExportConfig, `The log has been stored at ${exportDir}`, 'info');
}
}
}
2 changes: 1 addition & 1 deletion packages/contentstack-export/src/utils/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function init(_logPath: string) {
}

export const log = async (config: ExportConfig, message: any, type: string) => {
const logsPath = config.data || __dirname;
const logsPath = config.data;
// ignoring the type argument, as we are not using it to create a logfile anymore
if (type !== 'error') {
// removed type argument from init method
Expand Down

0 comments on commit d2597ee

Please sign in to comment.