Skip to content

Commit

Permalink
feat(mongodb-log-writer): add ability to set log location
Browse files Browse the repository at this point in the history
  • Loading branch information
gagik committed Jan 22, 2025
1 parent 27923b8 commit 10cb29c
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions packages/cli-repl/src/cli-repl.spec.ts
Original file line number Diff line number Diff line change
@@ -1526,6 +1526,14 @@ describe('CliRepl', function () {
expect(cliRepl.logWriter?.isDisabled).equals(true);
});

it('can set the log location', function () {
cliReplOptions.logLocation = './test/path';
cliRepl = new CliRepl(cliReplOptions);
expect(cliRepl.logWriter?.logFilePath).equals(
cliReplOptions.logLocation
);
});

it('sends out telemetry data for command line scripts', async function () {
cliReplOptions.shellCliOptions.eval = ['db.hello()'];
cliRepl = new CliRepl(cliReplOptions);
2 changes: 1 addition & 1 deletion packages/cli-repl/src/cli-repl.ts
Original file line number Diff line number Diff line change
@@ -194,7 +194,7 @@ export class CliRepl implements MongoshIOProvider {
});

this.logManager = new MongoLogManager({
directory: this.shellHomeDirectory.localPath('.'),
directory: options.logLocation ?? this.shellHomeDirectory.localPath('.'),
retentionDays: 30,
maxLogFileCount: +(
process.env.MONGOSH_TEST_ONLY_MAX_LOG_FILE_COUNT || 100

0 comments on commit 10cb29c

Please sign in to comment.