@@ -728,10 +728,7 @@ export class MongoLogger {
728
728
logDestination : MongoDBLogWritable ;
729
729
logDestinationIsStdErr : boolean ;
730
730
pendingLog : PromiseLike < unknown > | unknown = null ;
731
- willLog : Record < MongoLoggableComponent , Record < SeverityLevel , boolean > > = { } as Record <
732
- MongoLoggableComponent ,
733
- Record < SeverityLevel , boolean >
734
- > ;
731
+ willLog : Record < MongoLoggableComponent , Record < SeverityLevel , boolean > > ;
735
732
736
733
/**
737
734
* This method should be used when logging errors that do not have a public driver API for
@@ -764,18 +761,19 @@ export class MongoLogger {
764
761
this . maxDocumentLength = options . maxDocumentLength ;
765
762
this . logDestination = options . logDestination ;
766
763
this . logDestinationIsStdErr = options . logDestinationIsStdErr ;
767
- this . createWillLog ( ) ;
764
+ this . willLog = this . createWillLog ( ) ;
768
765
}
769
766
770
- createWillLog ( ) {
767
+ createWillLog ( ) : Record < MongoLoggableComponent , Record < SeverityLevel , boolean > > {
768
+ const willLog = Object ( ) ;
771
769
for ( const component of Object . values ( MongoLoggableComponent ) ) {
770
+ willLog [ component ] = { } ;
772
771
for ( const severityLevel of Object . values ( SeverityLevel ) ) {
773
- this . willLog [ component ] = {
774
- ...this . willLog [ component ] ,
775
- [ severityLevel ] : compareSeverity ( severityLevel , this . componentSeverities [ component ] ) <= 0
776
- } ;
772
+ willLog [ component ] [ severityLevel ] =
773
+ compareSeverity ( severityLevel , this . componentSeverities [ component ] ) <= 0 ;
777
774
}
778
775
}
776
+ return willLog ;
779
777
}
780
778
781
779
turnOffSeverities ( ) {
0 commit comments