Skip to content

Commit

Permalink
handled why logs where not created in mentioned path
Browse files Browse the repository at this point in the history
  • Loading branch information
cs-raj committed Feb 6, 2024
1 parent c8d71f6 commit 4a25fee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 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(__dirname, 'logs');
try {
const { flags } = await this.parse(ExportCommand);
let exportConfig = await setupExportConfig(flags);
Expand All @@ -117,8 +117,7 @@ export default class ExportCommand extends Command {
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')
`The log has been stored at ${exportDir
}`,
'info',
);
Expand Down
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 4a25fee

Please sign in to comment.