@@ -829,8 +829,6 @@ describe('MongoClient', function () {
829829 } ) ;
830830
831831 describe ( 'logging client options' , function ( ) {
832- const loggerFeatureFlag = __enableMongoLogger ;
833-
834832 describe ( 'mongodbLogPath' , function ( ) {
835833 context ( 'when mongodbLogPath is in options' , function ( ) {
836834 let stderrStub ;
@@ -848,7 +846,7 @@ describe('MongoClient', function () {
848846 context ( 'when option is `stderr`' , function ( ) {
849847 it ( 'it is accessible through mongoLogger.logDestination' , function ( ) {
850848 const client = new MongoClient ( 'mongodb://a/' , {
851- [ loggerFeatureFlag ] : true ,
849+ __enableMongoLogger : true ,
852850 mongodbLogPath : 'stderr'
853851 } ) ;
854852 const log = { t : new Date ( ) , c : 'constructorStdErr' , s : 'error' } ;
@@ -867,7 +865,7 @@ describe('MongoClient', function () {
867865 }
868866 } ;
869867 const client = new MongoClient ( 'mongodb://a/' , {
870- [ loggerFeatureFlag ] : true ,
868+ __enableMongoLogger : true ,
871869 mongodbLogPath : writable
872870 } ) ;
873871 expect ( client . options . mongoLoggerOptions . logDestination ) . to . deep . equal ( writable ) ;
@@ -877,7 +875,7 @@ describe('MongoClient', function () {
877875 context ( 'when option is `stdout`' , function ( ) {
878876 it ( 'it is accessible through mongoLogger.logDestination' , function ( ) {
879877 const client = new MongoClient ( 'mongodb://a/' , {
880- [ loggerFeatureFlag ] : true ,
878+ __enableMongoLogger : true ,
881879 mongodbLogPath : 'stdout'
882880 } ) ;
883881 const log = { t : new Date ( ) , c : 'constructorStdOut' , s : 'error' } ;
@@ -894,7 +892,7 @@ describe('MongoClient', function () {
894892 expect (
895893 ( ) =>
896894 new MongoClient ( 'mongodb://a/' , {
897- [ loggerFeatureFlag ] : true ,
895+ __enableMongoLogger : true ,
898896 mongodbLogPath : invalidOption
899897 } )
900898 ) . to . throw ( MongoAPIError ) ;
@@ -912,7 +910,7 @@ describe('MongoClient', function () {
912910 expect (
913911 ( ) =>
914912 new MongoClient ( 'mongodb://a/' , {
915- [ loggerFeatureFlag ] : true ,
913+ __enableMongoLogger : true ,
916914 mongodbLogPath : writable
917915 } )
918916 ) . to . throw ( MongoAPIError ) ;
@@ -934,7 +932,7 @@ describe('MongoClient', function () {
934932
935933 it ( 'should default to stderr' , function ( ) {
936934 const client = new MongoClient ( 'mongodb://a/' , {
937- [ loggerFeatureFlag ] : true
935+ __enableMongoLogger : true
938936 } ) ;
939937 const log = { t : new Date ( ) , c : 'constructorStdErr' , s : 'error' } ;
940938 client . options . mongoLoggerOptions . logDestination . write ( log ) ;
@@ -958,7 +956,7 @@ describe('MongoClient', function () {
958956 it ( `it stores severity levels for ${ components [ i ] } component correctly` , function ( ) {
959957 for ( const severityLevel of Object . values ( SeverityLevel ) ) {
960958 const client = new MongoClient ( 'mongodb://a/' , {
961- [ loggerFeatureFlag ] : true ,
959+ __enableMongoLogger : true ,
962960 mongodbLogComponentSeverities : {
963961 [ components [ i ] ] : severityLevel
964962 }
@@ -982,7 +980,7 @@ describe('MongoClient', function () {
982980 process . env [ env_component_names [ i ] ] = 'emergency' ;
983981 for ( const severityLevel of Object . values ( SeverityLevel ) ) {
984982 const client = new MongoClient ( 'mongodb://a/' , {
985- [ loggerFeatureFlag ] : true ,
983+ __enableMongoLogger : true ,
986984 mongodbLogComponentSeverities : {
987985 [ components [ i ] ] : severityLevel
988986 }
@@ -1007,7 +1005,7 @@ describe('MongoClient', function () {
10071005 for ( const severityLevel of Object . values ( SeverityLevel ) ) {
10081006 for ( const defaultSeverityLevel of Object . values ( SeverityLevel ) ) {
10091007 const client = new MongoClient ( 'mongodb://a/' , {
1010- [ loggerFeatureFlag ] : true ,
1008+ __enableMongoLogger : true ,
10111009 mongodbLogComponentSeverities : {
10121010 [ components [ i ] ] : severityLevel ,
10131011 default : defaultSeverityLevel
@@ -1032,7 +1030,7 @@ describe('MongoClient', function () {
10321030 context ( 'when invalid client option is provided' , function ( ) {
10331031 const badClientCreator = ( ) =>
10341032 new MongoClient ( 'mongodb://a/' , {
1035- [ loggerFeatureFlag ] : true ,
1033+ __enableMongoLogger : true ,
10361034 mongodbLogComponentSeverities : {
10371035 default : 'imFake'
10381036 }
@@ -1077,12 +1075,12 @@ describe('MongoClient', function () {
10771075 expect (
10781076 ( ) =>
10791077 new MongoClient ( 'mongodb://a/' , {
1080- [ loggerFeatureFlag ] : true ,
1078+ __enableMongoLogger : true ,
10811079 mongodbLogComponentSeverities : { }
10821080 } )
10831081 ) . to . not . throw ( MongoAPIError ) ;
10841082 const client = new MongoClient ( 'mongodb://a/' , {
1085- [ loggerFeatureFlag ] : true ,
1083+ __enableMongoLogger : true ,
10861084 mongodbLogComponentSeverities : { client : 'error' } // dummy so logger doesn't turn on
10871085 } ) ;
10881086 expect ( client . mongoLogger ?. componentSeverities . command ) . to . equal ( 'off' ) ;
@@ -1093,12 +1091,12 @@ describe('MongoClient', function () {
10931091 expect (
10941092 ( ) =>
10951093 new MongoClient ( 'mongodb://a/' , {
1096- [ loggerFeatureFlag ] : true ,
1094+ __enableMongoLogger : true ,
10971095 mongodbLogComponentSeverities : { default : 'emergency' }
10981096 } )
10991097 ) . to . not . throw ( MongoAPIError ) ;
11001098 const client = new MongoClient ( 'mongodb://a/' , {
1101- [ loggerFeatureFlag ] : true ,
1099+ __enableMongoLogger : true ,
11021100 mongodbLogComponentSeverities : { command : 'emergency' }
11031101 } ) ;
11041102 expect ( client . mongoLogger ?. componentSeverities . command ) . to . equal ( 'emergency' ) ;
@@ -1113,7 +1111,7 @@ describe('MongoClient', function () {
11131111 context ( 'when env option for MONGODB_LOG_MAX_DOCUMENT_LENGTH is not provided' , function ( ) {
11141112 it ( 'should store value for maxDocumentLength correctly' , function ( ) {
11151113 const client = new MongoClient ( 'mongodb://a/' , {
1116- [ loggerFeatureFlag ] : true ,
1114+ __enableMongoLogger : true ,
11171115 mongodbLogMaxDocumentLength : 290
11181116 } ) ;
11191117 expect ( client . options . mongoLoggerOptions . maxDocumentLength ) . to . equal ( 290 ) ;
@@ -1122,7 +1120,7 @@ describe('MongoClient', function () {
11221120 expect (
11231121 ( ) =>
11241122 new MongoClient ( 'mongodb://a/' , {
1125- [ loggerFeatureFlag ] : true ,
1123+ __enableMongoLogger : true ,
11261124 mongodbLogMaxDocumentLength : - 290
11271125 } )
11281126 ) . to . throw ( MongoParseError ) ;
@@ -1139,7 +1137,7 @@ describe('MongoClient', function () {
11391137
11401138 it ( 'should store value for maxDocumentLength correctly (client option value takes precedence)' , function ( ) {
11411139 const client = new MongoClient ( 'mongodb://a/' , {
1142- [ loggerFeatureFlag ] : true ,
1140+ __enableMongoLogger : true ,
11431141 mongodbLogMaxDocumentLength : 290
11441142 } ) ;
11451143 expect ( client . options . mongoLoggerOptions . maxDocumentLength ) . to . equal ( 290 ) ;
@@ -1148,7 +1146,7 @@ describe('MongoClient', function () {
11481146 expect (
11491147 ( ) =>
11501148 new MongoClient ( 'mongodb://a/' , {
1151- [ loggerFeatureFlag ] : true ,
1149+ __enableMongoLogger : true ,
11521150 mongodbLogMaxDocumentLength : - 290
11531151 } )
11541152 ) . to . throw ( MongoParseError ) ;
@@ -1159,7 +1157,7 @@ describe('MongoClient', function () {
11591157 context ( 'when env option for MONGODB_LOG_MAX_DOCUMENT_LENGTH is not provided' , function ( ) {
11601158 it ( 'should store value for default maxDocumentLength correctly' , function ( ) {
11611159 const client = new MongoClient ( 'mongodb://a/' , {
1162- [ loggerFeatureFlag ] : true
1160+ __enableMongoLogger : true
11631161 } ) ;
11641162 expect ( client . options . mongoLoggerOptions . maxDocumentLength ) . to . equal ( 1000 ) ;
11651163 } ) ;
@@ -1172,15 +1170,15 @@ describe('MongoClient', function () {
11721170 it ( 'should store value for maxDocumentLength correctly' , function ( ) {
11731171 process . env . MONGODB_LOG_MAX_DOCUMENT_LENGTH = '155' ;
11741172 const client = new MongoClient ( 'mongodb://a/' , {
1175- [ loggerFeatureFlag ] : true
1173+ __enableMongoLogger : true
11761174 } ) ;
11771175 expect ( client . options . mongoLoggerOptions . maxDocumentLength ) . to . equal ( 155 ) ;
11781176 } ) ;
11791177
11801178 it ( 'should not throw error for negative MONGODB_MAX_DOCUMENT_LENGTH and set to default' , function ( ) {
11811179 process . env . MONGODB_LOG_MAX_DOCUMENT_LENGTH = '-14' ;
11821180 const client = new MongoClient ( 'mongodb://a/' , {
1183- [ loggerFeatureFlag ] : true
1181+ __enableMongoLogger : true
11841182 } ) ;
11851183 expect ( client . options . mongoLoggerOptions . maxDocumentLength ) . to . equal ( 1000 ) ;
11861184 } ) ;
0 commit comments