@@ -22,13 +22,7 @@ import {
2222 type ServerApi ,
2323 ServerApiVersion
2424} 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' ;
3226import { ReadConcern , type ReadConcernLevel } from './read_concern' ;
3327import { ReadPreference , type ReadPreferenceMode } from './read_preference' ;
3428import { ServerMonitoringMode } from './sdam/monitor' ;
@@ -528,31 +522,22 @@ export function parseOptions(
528522 ) ;
529523 }
530524
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+ {
537527 MONGODB_LOG_COMMAND : process . env . MONGODB_LOG_COMMAND ,
538528 MONGODB_LOG_TOPOLOGY : process . env . MONGODB_LOG_TOPOLOGY ,
539529 MONGODB_LOG_SERVER_SELECTION : process . env . MONGODB_LOG_SERVER_SELECTION ,
540530 MONGODB_LOG_CONNECTION : process . env . MONGODB_LOG_CONNECTION ,
541531 MONGODB_LOG_CLIENT : process . env . MONGODB_LOG_CLIENT ,
542532 MONGODB_LOG_ALL : process . env . MONGODB_LOG_ALL ,
543533 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+ {
548537 mongodbLogPath : mongoOptions . mongodbLogPath ,
549538 mongodbLogComponentSeverities : mongoOptions . mongodbLogComponentSeverities ,
550539 mongodbLogMaxDocumentLength : mongoOptions . mongodbLogMaxDocumentLength
551- } ;
552- }
553- mongoOptions . mongoLoggerOptions = MongoLogger . resolveOptions (
554- loggerEnvOptions ,
555- loggerClientOptions
540+ }
556541 ) ;
557542
558543 mongoOptions . metadata = makeClientMetadata ( mongoOptions ) ;
@@ -1232,52 +1217,6 @@ export const OPTIONS = {
12321217 default : 0 ,
12331218 type : 'int'
12341219 } ,
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- */
12811220 mongodbLogPath : {
12821221 transform ( { values : [ value ] } ) {
12831222 if (
@@ -1296,10 +1235,6 @@ export const OPTIONS = {
12961235 return value ;
12971236 }
12981237 } ,
1299- /**
1300- * @internal
1301- * TODO: NODE-5671 - remove internal flag
1302- */
13031238 mongodbLogComponentSeverities : {
13041239 transform ( { values : [ value ] } ) {
13051240 if ( typeof value !== 'object' || ! value ) {
@@ -1325,14 +1260,49 @@ export const OPTIONS = {
13251260 return value ;
13261261 }
13271262 } ,
1328- /**
1329- * @internal
1330- * TODO: NODE-5671 - remove internal flag
1331- */
13321263 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' }
13361306} as Record < keyof MongoClientOptions , OptionDescriptor > ;
13371307
13381308export const DEFAULT_OPTIONS = new CaseInsensitiveMap (
0 commit comments