@bymax-one/nest-logger 1.4.11 → 1.4.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -579,6 +579,24 @@ declare class BymaxLoggerModule extends BymaxLoggerModuleBase {
579
579
  * await app.listen(3000)
580
580
  */
581
581
  static useNestLogger(app: INestApplication): void;
582
+ /**
583
+ * Open the request-id correlation scope ahead of the body parser, so a request the parser
584
+ * refuses (malformed JSON, an unsupported content encoding, a body over the limit) still has its
585
+ * `requestId`, and the `x-request-id` response header, where an exception filter reads it.
586
+ *
587
+ * Call once in `main.ts` AFTER creating the app and BEFORE `app.init()` / `app.listen(...)`.
588
+ * It mounts only the scope. `applyAccessLog(app)` and `applyRequestIdMiddleware(consumer)` can
589
+ * be used as well: a second mount of the middleware reuses the scope this one opened.
590
+ *
591
+ * @param app - The Nest application returned by `NestFactory.create()`.
592
+ * @throws Error When `BymaxLoggerModule` was not imported.
593
+ * @example
594
+ * const app = await NestFactory.create(AppModule, { bufferLogs: true })
595
+ * BymaxLoggerModule.useNestLogger(app)
596
+ * BymaxLoggerModule.useRequestContext(app)
597
+ * await app.listen(3000)
598
+ */
599
+ static useRequestContext(app: INestApplication): void;
582
600
  }
583
601
 
584
602
  /**
@@ -579,6 +579,24 @@ declare class BymaxLoggerModule extends BymaxLoggerModuleBase {
579
579
  * await app.listen(3000)
580
580
  */
581
581
  static useNestLogger(app: INestApplication): void;
582
+ /**
583
+ * Open the request-id correlation scope ahead of the body parser, so a request the parser
584
+ * refuses (malformed JSON, an unsupported content encoding, a body over the limit) still has its
585
+ * `requestId`, and the `x-request-id` response header, where an exception filter reads it.
586
+ *
587
+ * Call once in `main.ts` AFTER creating the app and BEFORE `app.init()` / `app.listen(...)`.
588
+ * It mounts only the scope. `applyAccessLog(app)` and `applyRequestIdMiddleware(consumer)` can
589
+ * be used as well: a second mount of the middleware reuses the scope this one opened.
590
+ *
591
+ * @param app - The Nest application returned by `NestFactory.create()`.
592
+ * @throws Error When `BymaxLoggerModule` was not imported.
593
+ * @example
594
+ * const app = await NestFactory.create(AppModule, { bufferLogs: true })
595
+ * BymaxLoggerModule.useNestLogger(app)
596
+ * BymaxLoggerModule.useRequestContext(app)
597
+ * await app.listen(3000)
598
+ */
599
+ static useRequestContext(app: INestApplication): void;
582
600
  }
583
601
 
584
602
  /**