| 314 | * A custom destination for structured logging messages. |
| 315 | */ |
| 316 | export 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 | |
| 336 | function compareSeverity(s0: SeverityLevel, s1: SeverityLevel): 1 | 0 | -1 { |
| 337 | const s0Num = SEVERITY_LEVEL_MAP.getNumericSeverityLevel(s0); |
no outgoing calls
no test coverage detected