Skip to content

Commit ef09094

Browse files
Casting fix
1 parent 0e3e4b2 commit ef09094

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

src/mongo_logger.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -728,10 +728,7 @@ export class MongoLogger {
728728
logDestination: MongoDBLogWritable;
729729
logDestinationIsStdErr: boolean;
730730
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>>;
735732

736733
/**
737734
* This method should be used when logging errors that do not have a public driver API for
@@ -764,18 +761,19 @@ export class MongoLogger {
764761
this.maxDocumentLength = options.maxDocumentLength;
765762
this.logDestination = options.logDestination;
766763
this.logDestinationIsStdErr = options.logDestinationIsStdErr;
767-
this.createWillLog();
764+
this.willLog = this.createWillLog();
768765
}
769766

770-
createWillLog() {
767+
createWillLog(): Record<MongoLoggableComponent, Record<SeverityLevel, boolean>> {
768+
const willLog = Object();
771769
for (const component of Object.values(MongoLoggableComponent)) {
770+
willLog[component] = {};
772771
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;
777774
}
778775
}
776+
return willLog;
779777
}
780778

781779
turnOffSeverities() {

test/integration/retryable-reads/retryable_reads.spec.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { TestRunnerContext, generateTopologyTests } = require('../../tools/spec-r
33
const { loadSpecTests } = require('../../spec');
44
const { runUnifiedSuite } = require('../../tools/unified-spec-runner/runner');
55

6-
describe('Retryable Reads (legacy)', function () {
6+
describe.only('Retryable Reads (legacy)', function () {
77
const testContext = new TestRunnerContext();
88
const testSuites = loadSpecTests(path.join('retryable-reads', 'legacy'));
99

0 commit comments

Comments
 (0)