Skip to content

Commit f24620d

Browse files
committed
fix logging test
1 parent 2e3cb29 commit f24620d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/data-service/src/data-service.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,11 +1606,12 @@ class DataServiceImpl extends WithLogContext implements DataService {
16061606
debug('connecting...');
16071607
this._isConnecting = true;
16081608

1609+
const clusterName = this._connectionOptions.lookup?.().clusterName;
16091610
this._logger.info(mongoLogId(1_001_000_014), 'Connecting Started', {
1610-
clusterName: this._connectionOptions.lookup?.().clusterName,
16111611
connectionId: this._id,
16121612
url: redactConnectionString(this._connectionOptions.connectionString),
16131613
csfle: this._csfleLogInformation(this._connectionOptions.fleOptions),
1614+
...(clusterName && { clusterName }),
16141615
});
16151616

16161617
try {
@@ -1629,9 +1630,9 @@ class DataServiceImpl extends WithLogContext implements DataService {
16291630

16301631
const attr = {
16311632
connectionId: this._id,
1632-
clusterName: this._connectionOptions.lookup?.().clusterName,
16331633
isWritable: this.isWritable(),
16341634
isMongos: this.isMongos(),
1635+
...(clusterName && { clusterName }),
16351636
};
16361637

16371638
this._logger.info(
@@ -1664,11 +1665,11 @@ class DataServiceImpl extends WithLogContext implements DataService {
16641665
} catch (error) {
16651666
this._logger.info(mongoLogId(1_001_000_359), 'Connecting Failed', {
16661667
connectionId: this._id,
1667-
clusterName: this._connectionOptions.lookup?.().clusterName,
16681668
error:
16691669
error && typeof error === 'object' && 'message' in error
16701670
? error?.message
16711671
: 'unknown error',
1672+
...(clusterName && { clusterName }),
16721673
});
16731674
throw error;
16741675
} finally {

0 commit comments

Comments
 (0)