Skip to content

Commit 70cace8

Browse files
authored
refactor(NODE-3356): Remove logs that duplicate command monitoring functionality (#2851)
1 parent ac49df6 commit 70cace8

File tree

4 files changed

+0
-200
lines changed

4 files changed

+0
-200
lines changed

src/operations/command.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,6 @@ export abstract class CommandOperation<T> extends AbstractOperation<T> {
160160
cmd.comment = options.comment;
161161
}
162162

163-
if (this.logger && this.logger.isDebug()) {
164-
this.logger.debug(`executing command ${JSON.stringify(cmd)} against ${this.ns}`);
165-
}
166-
167163
if (this.hasAspect(Aspect.EXPLAINABLE) && this.explain) {
168164
if (serverWireVersion < 6 && cmd.aggregate) {
169165
// Prior to 3.6, with aggregate, verbosity is ignored, and we must pass in "explain: true"

src/sdam/server.ts

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { Monitor, MonitorOptions } from './monitor';
1010
import { isTransactionCommand } from '../transactions';
1111
import {
1212
collationNotSupported,
13-
debugOptions,
1413
makeStateMachine,
1514
maxWireVersion,
1615
Callback,
@@ -56,34 +55,6 @@ import type { AutoEncrypter } from '../deps';
5655
import type { ServerApi } from '../mongo_client';
5756
import { TypedEventEmitter } from '../mongo_types';
5857

59-
// Used for filtering out fields for logging
60-
const DEBUG_FIELDS = [
61-
'reconnect',
62-
'reconnectTries',
63-
'reconnectInterval',
64-
'emitError',
65-
'cursorFactory',
66-
'host',
67-
'port',
68-
'size',
69-
'keepAlive',
70-
'keepAliveInitialDelay',
71-
'noDelay',
72-
'connectionTimeout',
73-
'checkServerIdentity',
74-
'socketTimeoutMS',
75-
'ssl',
76-
'ca',
77-
'crl',
78-
'cert',
79-
'key',
80-
'rejectUnauthorized',
81-
'promoteLongs',
82-
'promoteValues',
83-
'promoteBuffers',
84-
'servername'
85-
];
86-
8758
const stateTransition = makeStateMachine({
8859
[STATE_CLOSED]: [STATE_CLOSED, STATE_CONNECTING],
8960
[STATE_CONNECTING]: [STATE_CONNECTING, STATE_CLOSING, STATE_CONNECTED, STATE_CLOSED],
@@ -304,17 +275,6 @@ export class Server extends TypedEventEmitter<ServerEvents> {
304275
// Clone the options
305276
const finalOptions = Object.assign({}, options, { wireProtocolCommand: false });
306277

307-
// Debug log
308-
if (this.s.logger.isDebug()) {
309-
this.s.logger.debug(
310-
`executing command [${JSON.stringify({
311-
ns,
312-
cmd,
313-
options: debugOptions(DEBUG_FIELDS, options)
314-
})}] against ${this.name}`
315-
);
316-
}
317-
318278
// error if collation not supported
319279
if (collationNotSupported(this, cmd)) {
320280
callback(new MongoDriverError(`server ${this.name} does not support collation`));

src/utils.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,6 @@ export function isObject(arg: unknown): arg is object {
172172
return '[object Object]' === Object.prototype.toString.call(arg);
173173
}
174174

175-
/** @internal */
176-
export function debugOptions(debugFields: string[], options?: AnyOptions): Document {
177-
const finalOptions: AnyOptions = {};
178-
if (!options) return finalOptions;
179-
debugFields.forEach(n => {
180-
finalOptions[n] = options[n];
181-
});
182-
183-
return finalOptions;
184-
}
185-
186175
/** @internal */
187176
export function decorateCommand(command: Document, options: Document, exclude: string[]): Document {
188177
for (const name in options) {

test/functional/logger.test.js

Lines changed: 0 additions & 145 deletions
This file was deleted.

0 commit comments

Comments
 (0)