@@ -22,13 +22,7 @@ import {
22
22
type ServerApi ,
23
23
ServerApiVersion
24
24
} from './mongo_client' ;
25
- import {
26
- MongoLoggableComponent ,
27
- MongoLogger ,
28
- type MongoLoggerEnvOptions ,
29
- type MongoLoggerMongoClientOptions ,
30
- SeverityLevel
31
- } from './mongo_logger' ;
25
+ import { MongoLoggableComponent , MongoLogger , SeverityLevel } from './mongo_logger' ;
32
26
import { ReadConcern , type ReadConcernLevel } from './read_concern' ;
33
27
import { ReadPreference , type ReadPreferenceMode } from './read_preference' ;
34
28
import { ServerMonitoringMode } from './sdam/monitor' ;
@@ -528,31 +522,22 @@ export function parseOptions(
528
522
) ;
529
523
}
530
524
531
- mongoOptions . __enableMongoLogger = mongoOptions . __enableMongoLogger ?? false ;
532
-
533
- let loggerEnvOptions : MongoLoggerEnvOptions = { } ;
534
- let loggerClientOptions : MongoLoggerMongoClientOptions = { } ;
535
- if ( mongoOptions . __enableMongoLogger ) {
536
- loggerEnvOptions = {
525
+ mongoOptions . mongoLoggerOptions = MongoLogger . resolveOptions (
526
+ {
537
527
MONGODB_LOG_COMMAND : process . env . MONGODB_LOG_COMMAND ,
538
528
MONGODB_LOG_TOPOLOGY : process . env . MONGODB_LOG_TOPOLOGY ,
539
529
MONGODB_LOG_SERVER_SELECTION : process . env . MONGODB_LOG_SERVER_SELECTION ,
540
530
MONGODB_LOG_CONNECTION : process . env . MONGODB_LOG_CONNECTION ,
541
531
MONGODB_LOG_CLIENT : process . env . MONGODB_LOG_CLIENT ,
542
532
MONGODB_LOG_ALL : process . env . MONGODB_LOG_ALL ,
543
533
MONGODB_LOG_MAX_DOCUMENT_LENGTH : process . env . MONGODB_LOG_MAX_DOCUMENT_LENGTH ,
544
- MONGODB_LOG_PATH : process . env . MONGODB_LOG_PATH ,
545
- ...mongoOptions . __internalLoggerConfig
546
- } ;
547
- loggerClientOptions = {
534
+ MONGODB_LOG_PATH : process . env . MONGODB_LOG_PATH
535
+ } ,
536
+ {
548
537
mongodbLogPath : mongoOptions . mongodbLogPath ,
549
538
mongodbLogComponentSeverities : mongoOptions . mongodbLogComponentSeverities ,
550
539
mongodbLogMaxDocumentLength : mongoOptions . mongodbLogMaxDocumentLength
551
- } ;
552
- }
553
- mongoOptions . mongoLoggerOptions = MongoLogger . resolveOptions (
554
- loggerEnvOptions ,
555
- loggerClientOptions
540
+ }
556
541
) ;
557
542
558
543
mongoOptions . metadata = makeClientMetadata ( mongoOptions ) ;
@@ -1232,52 +1217,6 @@ export const OPTIONS = {
1232
1217
default : 0 ,
1233
1218
type : 'int'
1234
1219
} ,
1235
- // Custom types for modifying core behavior
1236
- connectionType : { type : 'any' } ,
1237
- srvPoller : { type : 'any' } ,
1238
- // Accepted Node.js Options
1239
- allowPartialTrustChain : { type : 'any' } ,
1240
- minDHSize : { type : 'any' } ,
1241
- pskCallback : { type : 'any' } ,
1242
- secureContext : { type : 'any' } ,
1243
- enableTrace : { type : 'any' } ,
1244
- requestCert : { type : 'any' } ,
1245
- rejectUnauthorized : { type : 'any' } ,
1246
- checkServerIdentity : { type : 'any' } ,
1247
- ALPNProtocols : { type : 'any' } ,
1248
- SNICallback : { type : 'any' } ,
1249
- session : { type : 'any' } ,
1250
- requestOCSP : { type : 'any' } ,
1251
- localAddress : { type : 'any' } ,
1252
- localPort : { type : 'any' } ,
1253
- hints : { type : 'any' } ,
1254
- lookup : { type : 'any' } ,
1255
- ca : { type : 'any' } ,
1256
- cert : { type : 'any' } ,
1257
- ciphers : { type : 'any' } ,
1258
- crl : { type : 'any' } ,
1259
- ecdhCurve : { type : 'any' } ,
1260
- key : { type : 'any' } ,
1261
- passphrase : { type : 'any' } ,
1262
- pfx : { type : 'any' } ,
1263
- secureProtocol : { type : 'any' } ,
1264
- index : { type : 'any' } ,
1265
- // Legacy options from v3 era
1266
- useNewUrlParser : {
1267
- type : 'boolean' ,
1268
- deprecated :
1269
- 'useNewUrlParser has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version'
1270
- } as OptionDescriptor ,
1271
- useUnifiedTopology : {
1272
- type : 'boolean' ,
1273
- deprecated :
1274
- 'useUnifiedTopology has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version'
1275
- } as OptionDescriptor ,
1276
- // MongoLogger
1277
- /**
1278
- * @internal
1279
- * TODO: NODE-5671 - remove internal flag
1280
- */
1281
1220
mongodbLogPath : {
1282
1221
transform ( { values : [ value ] } ) {
1283
1222
if (
@@ -1296,10 +1235,6 @@ export const OPTIONS = {
1296
1235
return value ;
1297
1236
}
1298
1237
} ,
1299
- /**
1300
- * @internal
1301
- * TODO: NODE-5671 - remove internal flag
1302
- */
1303
1238
mongodbLogComponentSeverities : {
1304
1239
transform ( { values : [ value ] } ) {
1305
1240
if ( typeof value !== 'object' || ! value ) {
@@ -1325,14 +1260,49 @@ export const OPTIONS = {
1325
1260
return value ;
1326
1261
}
1327
1262
} ,
1328
- /**
1329
- * @internal
1330
- * TODO: NODE-5671 - remove internal flag
1331
- */
1332
1263
mongodbLogMaxDocumentLength : { type : 'uint' } ,
1333
- __enableMongoLogger : { type : 'boolean' } ,
1334
- __skipPingOnConnect : { type : 'boolean' } ,
1335
- __internalLoggerConfig : { type : 'record' }
1264
+ // Custom types for modifying core behavior
1265
+ connectionType : { type : 'any' } ,
1266
+ srvPoller : { type : 'any' } ,
1267
+ // Accepted Node.js Options
1268
+ allowPartialTrustChain : { type : 'any' } ,
1269
+ minDHSize : { type : 'any' } ,
1270
+ pskCallback : { type : 'any' } ,
1271
+ secureContext : { type : 'any' } ,
1272
+ enableTrace : { type : 'any' } ,
1273
+ requestCert : { type : 'any' } ,
1274
+ rejectUnauthorized : { type : 'any' } ,
1275
+ checkServerIdentity : { type : 'any' } ,
1276
+ ALPNProtocols : { type : 'any' } ,
1277
+ SNICallback : { type : 'any' } ,
1278
+ session : { type : 'any' } ,
1279
+ requestOCSP : { type : 'any' } ,
1280
+ localAddress : { type : 'any' } ,
1281
+ localPort : { type : 'any' } ,
1282
+ hints : { type : 'any' } ,
1283
+ lookup : { type : 'any' } ,
1284
+ ca : { type : 'any' } ,
1285
+ cert : { type : 'any' } ,
1286
+ ciphers : { type : 'any' } ,
1287
+ crl : { type : 'any' } ,
1288
+ ecdhCurve : { type : 'any' } ,
1289
+ key : { type : 'any' } ,
1290
+ passphrase : { type : 'any' } ,
1291
+ pfx : { type : 'any' } ,
1292
+ secureProtocol : { type : 'any' } ,
1293
+ index : { type : 'any' } ,
1294
+ // Legacy options from v3 era
1295
+ useNewUrlParser : {
1296
+ type : 'boolean' ,
1297
+ deprecated :
1298
+ 'useNewUrlParser has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version'
1299
+ } as OptionDescriptor ,
1300
+ useUnifiedTopology : {
1301
+ type : 'boolean' ,
1302
+ deprecated :
1303
+ 'useUnifiedTopology has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version'
1304
+ } as OptionDescriptor ,
1305
+ __skipPingOnConnect : { type : 'boolean' }
1336
1306
} as Record < keyof MongoClientOptions , OptionDescriptor > ;
1337
1307
1338
1308
export const DEFAULT_OPTIONS = new CaseInsensitiveMap (
0 commit comments