Skip to content

Commit

Permalink
feat(NODE-4814): Add severity loggers and unskip tests
Browse files Browse the repository at this point in the history
  • Loading branch information
W-A-James committed Apr 14, 2023
1 parent d502eb0 commit c2324c9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
20 changes: 18 additions & 2 deletions src/mongo_logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,14 +430,30 @@ export class MongoLogger {
maxDocumentLength: number;
logDestination: MongoDBLogWritable | Writable;

emergency = this.log.bind(this, 'emergency');
/** @experimental */
alert = this.log.bind(this, 'alert');
/** @experimental */
critical = this.log.bind(this, 'critical');
/** @experimental */
error = this.log.bind(this, 'error');
/** @experimental */
warning = this.log.bind(this, 'warn');
/** @experimental */
notice = this.log.bind(this, 'notice');
/** @experimental */
info = this.log.bind(this, 'info');
/** @experimental */
debug = this.log.bind(this, 'debug');
/** @experimental */
trace = this.log.bind(this, 'trace');

constructor(options: MongoLoggerOptions) {
this.componentSeverities = options.componentSeverities;
this.maxDocumentLength = options.maxDocumentLength;
this.logDestination = options.logDestination;
}

emergency = this.log.bind(this, 'emergency');

private log(
severity: SeverityLevel,
component: MongoLoggableComponent,
Expand Down
3 changes: 1 addition & 2 deletions test/unit/mongo_logger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,7 @@ describe('class MongoLogger', function () {
expect(stream.buffer).to.have.lengthOf(0);
});

// TODO(NODE-4814): Unskip this test
context.skip('when the log severity is greater than what was configured', function () {
context('when the log severity is greater than what was configured', function () {
it('does not write to logDestination', function () {
const stream = new BufferingStream();
const logger = new MongoLogger({
Expand Down

0 comments on commit c2324c9

Please sign in to comment.