MCPcopy
hub / github.com/mongodb/node-mongodb-native / MongoDBLogWritable

Interface MongoDBLogWritable

src/mongo_logger.ts:316–334  ·  src/mongo_logger.ts::MongoDBLogWritable

Source from the content-addressed store, hash-verified

314 * A custom destination for structured logging messages.
315 */
316export interface MongoDBLogWritable {
317 /**
318 * This function will be called for every enabled log message.
319 *
320 * It can be sync or async:
321 * - If it is synchronous it will block the driver from proceeding until this method returns.
322 * - If it is asynchronous the driver will not await the returned promise. It will attach fulfillment handling (`.then`).
323 * If the promise rejects the logger will write an error message to stderr and stop functioning.
324 * If the promise resolves the driver proceeds to the next log message (or waits for new ones to occur).
325 *
326 * Tips:
327 * - We recommend writing an async `write` function that _never_ rejects.
328 * Instead handle logging errors as necessary to your use case and make the write function a noop, until it can be recovered.
329 * - The Log messages are structured but **subject to change** since the intended purpose is informational.
330 * Program against this defensively and err on the side of stringifying whatever is passed in to write in some form or another.
331 *
332 */
333 write(log: Log): PromiseLike<unknown> | unknown;
334}
335
336function compareSeverity(s0: SeverityLevel, s1: SeverityLevel): 1 | 0 | -1 {
337 const s0Num = SEVERITY_LEVEL_MAP.getNumericSeverityLevel(s0);

Callers 8

request.jsFile · 0.65
logFunction · 0.65
insert.test.tsFile · 0.65
logFunction · 0.65
node_csot.test.tsFile · 0.65

Implementers 5

TestConfigurationtest/tools/runner/config.ts
AstrolabeResultsWritertest/tools/unified-spec-runner/astrola
UnifiedMongoClienttest/tools/unified-spec-runner/entitie
MockSockettest/unit/cmap/connection.test.ts
MockSockettest/unit/client-side-encryption/state

Calls

no outgoing calls

Tested by

no test coverage detected