File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -1448,7 +1448,10 @@ describe('CliRepl', function () {
14481448 ) ;
14491449 } ) ;
14501450
1451- it ( 'does not use a prefix if the custom location is the same as the home location' , async function ( ) {
1451+ it ( 'uses a prefix even if the custom location is the same as the home location' , async function ( ) {
1452+ // This is a corner case where the custom location is the same as the home location.
1453+ // The prefix is still added to the log file name for consistency. If the user needs
1454+ // the default behavior for the log names, they should instead set the location to undefined.
14521455 const customLogHomePath = cliRepl . shellHomeDirectory . localPath ( '.' ) ;
14531456 cliRepl . config . logLocation = customLogHomePath ;
14541457 await cliRepl . start ( await testServer . connectionString ( ) , { } ) ;
Original file line number Diff line number Diff line change @@ -255,12 +255,11 @@ export class CliRepl implements MongoshIOProvider {
255255 throw new Error ( 'Logging and telemetry not setup' ) ;
256256 }
257257
258- const defaultDirectory = this . shellHomeDirectory . localPath ( '.' ) ;
259- const directory = ( await this . getConfig ( 'logLocation' ) ) || defaultDirectory ;
258+ const customLogLocation = await this . getConfig ( 'logLocation' ) ;
260259
261260 this . logManager ??= new MongoLogManager ( {
262- directory,
263- prefix : directory !== defaultDirectory ? 'mongosh_' : undefined ,
261+ directory : customLogLocation || this . shellHomeDirectory . localPath ( '.' ) ,
262+ prefix : customLogLocation ? 'mongosh_' : undefined ,
264263 retentionDays : await this . getConfig ( 'logRetentionDays' ) ,
265264 gzip : await this . getConfig ( 'logCompressionEnabled' ) ,
266265 maxLogFileCount : await this . getConfig ( 'logMaxFileCount' ) ,
You can’t perform that action at this time.
0 commit comments