Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/operations/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,6 @@ export abstract class CommandOperation<T> extends AbstractOperation<T> {
cmd.comment = options.comment;
}

if (this.logger && this.logger.isDebug()) {
this.logger.debug(`executing command ${JSON.stringify(cmd)} against ${this.ns}`);
}

if (this.hasAspect(Aspect.EXPLAINABLE) && this.explain) {
if (serverWireVersion < 6 && cmd.aggregate) {
// Prior to 3.6, with aggregate, verbosity is ignored, and we must pass in "explain: true"
Expand Down
40 changes: 0 additions & 40 deletions src/sdam/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { Monitor, MonitorOptions } from './monitor';
import { isTransactionCommand } from '../transactions';
import {
collationNotSupported,
debugOptions,
makeStateMachine,
maxWireVersion,
Callback,
Expand Down Expand Up @@ -56,34 +55,6 @@ import type { AutoEncrypter } from '../deps';
import type { ServerApi } from '../mongo_client';
import { TypedEventEmitter } from '../mongo_types';

// Used for filtering out fields for logging
const DEBUG_FIELDS = [
'reconnect',
'reconnectTries',
'reconnectInterval',
'emitError',
'cursorFactory',
'host',
'port',
'size',
'keepAlive',
'keepAliveInitialDelay',
'noDelay',
'connectionTimeout',
'checkServerIdentity',
'socketTimeoutMS',
'ssl',
'ca',
'crl',
'cert',
'key',
'rejectUnauthorized',
'promoteLongs',
'promoteValues',
'promoteBuffers',
'servername'
];

const stateTransition = makeStateMachine({
[STATE_CLOSED]: [STATE_CLOSED, STATE_CONNECTING],
[STATE_CONNECTING]: [STATE_CONNECTING, STATE_CLOSING, STATE_CONNECTED, STATE_CLOSED],
Expand Down Expand Up @@ -304,17 +275,6 @@ export class Server extends TypedEventEmitter<ServerEvents> {
// Clone the options
const finalOptions = Object.assign({}, options, { wireProtocolCommand: false });

// Debug log
if (this.s.logger.isDebug()) {
this.s.logger.debug(
`executing command [${JSON.stringify({
ns,
cmd,
options: debugOptions(DEBUG_FIELDS, options)
})}] against ${this.name}`
);
}

// error if collation not supported
if (collationNotSupported(this, cmd)) {
callback(new MongoDriverError(`server ${this.name} does not support collation`));
Expand Down
11 changes: 0 additions & 11 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,6 @@ export function isObject(arg: unknown): arg is object {
return '[object Object]' === Object.prototype.toString.call(arg);
}

/** @internal */
export function debugOptions(debugFields: string[], options?: AnyOptions): Document {
const finalOptions: AnyOptions = {};
if (!options) return finalOptions;
debugFields.forEach(n => {
finalOptions[n] = options[n];
});

return finalOptions;
}

/** @internal */
export function decorateCommand(command: Document, options: Document, exclude: string[]): Document {
for (const name in options) {
Expand Down
145 changes: 0 additions & 145 deletions test/functional/logger.test.js

This file was deleted.