@bymax-one/nest-logger 1.4.16 → 1.4.18
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.
- package/CHANGELOG.md +171 -1
- package/README.md +87 -49
- package/dist/server/index.cjs +631 -80
- package/dist/server/index.d.cts +115 -6
- package/dist/server/index.d.ts +115 -6
- package/dist/server/index.mjs +632 -81
- package/package.json +2 -2
package/dist/server/index.d.cts
CHANGED
|
@@ -173,6 +173,15 @@ interface ILogDestination {
|
|
|
173
173
|
* @param payload — Newline-terminated JSON entry, UTF-8 encoded.
|
|
174
174
|
*/
|
|
175
175
|
write(payload: string): void | PromiseLike<void>;
|
|
176
|
+
/**
|
|
177
|
+
* Optional: the bytes this destination holds in a buffer of its own that has not reached its
|
|
178
|
+
* medium yet. The module adds it to its own queue in front of the destination and drops an entry
|
|
179
|
+
* that would take the total past `destinationQueue.maxBytes`. Report only a buffer that grows
|
|
180
|
+
* when the medium stalls (a stream's write queue, a batch waiting to be sent). A destination that
|
|
181
|
+
* does not buffer, or does not define it, is bounded by the module's queue alone. A value that
|
|
182
|
+
* is not a finite number, or a throw, counts as `0`.
|
|
183
|
+
*/
|
|
184
|
+
queuedBytes?(): number;
|
|
176
185
|
/**
|
|
177
186
|
* Optional lifecycle hook — called once during NestJS module init.
|
|
178
187
|
* Use for opening connections, allocating buffers, scheduling flushers.
|
|
@@ -203,7 +212,8 @@ interface ILogDestination {
|
|
|
203
212
|
* @param status.heldEntriesDeliveredElsewhere - Whether another live sink
|
|
204
213
|
* accepted everything this destination accepted, as far as this library can
|
|
205
214
|
* see. `true` requires that sink to be not this one, initialized, at or below
|
|
206
|
-
* this level, with no write failure
|
|
215
|
+
* this level, with no write failure, no entry dropped for want of queue room and no write
|
|
216
|
+
* still in flight; anything
|
|
207
217
|
* less certain is `false`.
|
|
208
218
|
*
|
|
209
219
|
* **What it cannot see:** a write still QUEUED inside the `Writable` adapter,
|
|
@@ -391,6 +401,21 @@ interface HttpOptions {
|
|
|
391
401
|
* crafted URL into a ReDoS vector. The defaults are anchored and safe.
|
|
392
402
|
*/
|
|
393
403
|
excludePaths?: readonly RegExp[];
|
|
404
|
+
/**
|
|
405
|
+
* Patterns for path segments that carry a credential, in addition to the built-in ones.
|
|
406
|
+
*
|
|
407
|
+
* A reset, verification or invitation link puts its token in the path, where neither the query
|
|
408
|
+
* stripping nor key-name redaction can reach it. The logger replaces such a segment with
|
|
409
|
+
* `:redacted` in `url`, `fullUrl` and the path echoed in a not-found message, and keeps the rest
|
|
410
|
+
* of the route. Built in: a hex value of 32 or more digits, a JWT, an opaque token of 32 or more
|
|
411
|
+
* base64 or base64url characters that is not a slug, a snake_case name or a UUID, and a hex run of 32 or more digits inside a
|
|
412
|
+
* segment,
|
|
413
|
+
* and an email address; a file extension after a token is ignored.
|
|
414
|
+
*
|
|
415
|
+
* Each pattern is `.test()`-ed against ONE percent-decoded segment, so anchor it (`/^tok_/`) and
|
|
416
|
+
* keep it linear-time, as with {@link HttpOptions.excludePaths}. Default: none.
|
|
417
|
+
*/
|
|
418
|
+
secretPathSegments?: readonly RegExp[];
|
|
394
419
|
/**
|
|
395
420
|
* Header name carrying the tenant identifier, or `false` to read no header. Default:
|
|
396
421
|
* `x-tenant-id`.
|
|
@@ -419,6 +444,52 @@ interface HttpOptions {
|
|
|
419
444
|
type ResolvedHttpOptions = Required<Omit<HttpOptions, 'tenantIdResolver'>> & {
|
|
420
445
|
tenantIdResolver: HttpOptions['tenantIdResolver'];
|
|
421
446
|
};
|
|
447
|
+
/**
|
|
448
|
+
* The bound on the entries each destination may hold queued.
|
|
449
|
+
*
|
|
450
|
+
* Pino hands every entry to a destination whether or not the destination has taken the last one, so
|
|
451
|
+
* a destination slower than the application, or a stdout whose reader has stalled, queues without
|
|
452
|
+
* limit and the process grows until it is killed. Past the bound the module drops the NEW entry for
|
|
453
|
+
* that destination, counts it, and says so on stderr: a bounded loss with a signal, in place of
|
|
454
|
+
* growth without one.
|
|
455
|
+
*/
|
|
456
|
+
interface DestinationQueueOptions {
|
|
457
|
+
/**
|
|
458
|
+
* The most bytes one destination may hold queued, in UTF-8 bytes of the NDJSON lines. Default:
|
|
459
|
+
* 33554432 (32 MiB). An integer from 1024 to 2147483647, or `0` for no bound.
|
|
460
|
+
*
|
|
461
|
+
* The count is the module's own queue in front of the destination plus what the destination
|
|
462
|
+
* reports through `ILogDestination.queuedBytes`, which the default stdout destination does for
|
|
463
|
+
* `process.stdout`. An entry that would take the total past the bound is not written to that
|
|
464
|
+
* destination; the others still receive it. A stderr line says so, at most once every 10 seconds
|
|
465
|
+
* for each destination, with the number dropped and never an entry's content, and a last line at
|
|
466
|
+
* shutdown gives the total. `0` restores unbounded queues.
|
|
467
|
+
*/
|
|
468
|
+
maxBytes?: number;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* The time application shutdown has to flush the destinations.
|
|
472
|
+
*
|
|
473
|
+
* Shutdown first drains the queue each destination holds, then calls each destination's
|
|
474
|
+
* `onShutdown` in reverse registration order. The whole sequence is bounded by `timeoutMs`, whatever
|
|
475
|
+
* the number of destinations: a destination reached after the budget is spent is reported as skipped
|
|
476
|
+
* and its `onShutdown` is not called.
|
|
477
|
+
*/
|
|
478
|
+
interface ShutdownOptions {
|
|
479
|
+
/**
|
|
480
|
+
* The total budget of shutdown, in milliseconds, covering the drain and every `onShutdown`.
|
|
481
|
+
* Default: 10000. An integer from 1 to 2147483647. Keep it below the grace period your platform
|
|
482
|
+
* gives the process, together with whatever else shuts down in it.
|
|
483
|
+
*/
|
|
484
|
+
timeoutMs?: number;
|
|
485
|
+
/**
|
|
486
|
+
* How long the drain may take, in milliseconds. Default: 5000. An integer from 1 to
|
|
487
|
+
* 2147483647, and not above `timeoutMs`. When it ends with entries still queued, one line naming
|
|
488
|
+
* the destinations and their queued sizes is written to stderr and shutdown goes on to
|
|
489
|
+
* `onShutdown`.
|
|
490
|
+
*/
|
|
491
|
+
drainTimeoutMs?: number;
|
|
492
|
+
}
|
|
422
493
|
/**
|
|
423
494
|
* OpenTelemetry integration tuning — applied by `TraceContextMixin` when the
|
|
424
495
|
* `@opentelemetry/api` peer dependency is installed.
|
|
@@ -549,6 +620,21 @@ interface BymaxLoggerModuleOptions {
|
|
|
549
620
|
otel?: OtelOptions;
|
|
550
621
|
/** Maximum size in bytes per log entry. Default: 65536. */
|
|
551
622
|
maxEntrySizeBytes?: number;
|
|
623
|
+
/**
|
|
624
|
+
* The longest a destination's `onInit` or `onRegistryReady` may take, in milliseconds. Default:
|
|
625
|
+
* 10000. An integer from 1 to 2147483647 (the largest delay a timer holds).
|
|
626
|
+
*
|
|
627
|
+
* An `onInit` that does not settle in time is treated as one that threw: the destination is
|
|
628
|
+
* marked failed, skipped and reported on stderr, and if the abandoned call settles later the
|
|
629
|
+
* destination stays inactive, receives no writes and no `onShutdown`. The call cannot be
|
|
630
|
+
* cancelled, so a hung `onInit` may leak what it opened. An `onRegistryReady` that does not
|
|
631
|
+
* settle in time is reported and bootstrap goes on.
|
|
632
|
+
*/
|
|
633
|
+
destinationHookTimeoutMs?: number;
|
|
634
|
+
/** How long application shutdown may take to flush the destinations. */
|
|
635
|
+
shutdown?: ShutdownOptions;
|
|
636
|
+
/** How much each destination may hold queued before the module drops entries. */
|
|
637
|
+
destinationQueue?: DestinationQueueOptions;
|
|
552
638
|
/**
|
|
553
639
|
* Which of an error's own fields are written beside its `type`, `message`, `stack` and `cause`.
|
|
554
640
|
*
|
|
@@ -583,9 +669,11 @@ interface BymaxLoggerModuleOptions {
|
|
|
583
669
|
* middleware) consumes — distinct from the loosely-typed
|
|
584
670
|
* `BymaxLoggerModuleOptions` the consumer supplies.
|
|
585
671
|
*/
|
|
586
|
-
type ResolvedBymaxLoggerModuleOptions = Readonly<Required<Omit<BymaxLoggerModuleOptions, 'http' | 'otel'>> & {
|
|
672
|
+
type ResolvedBymaxLoggerModuleOptions = Readonly<Required<Omit<BymaxLoggerModuleOptions, 'http' | 'otel' | 'shutdown' | 'destinationQueue'>> & {
|
|
587
673
|
http: ResolvedHttpOptions;
|
|
588
674
|
otel: Required<OtelOptions>;
|
|
675
|
+
shutdown: Required<ShutdownOptions>;
|
|
676
|
+
destinationQueue: Required<DestinationQueueOptions>;
|
|
589
677
|
}>;
|
|
590
678
|
/**
|
|
591
679
|
* Factory interface used by `useExisting` / `useClass` async wiring.
|
|
@@ -1095,9 +1183,10 @@ declare class LogContextService {
|
|
|
1095
1183
|
/**
|
|
1096
1184
|
* Canonical destination that writes log payloads to `process.stdout`.
|
|
1097
1185
|
*
|
|
1098
|
-
* `process.stdout.write` is buffered by Node.js, which
|
|
1099
|
-
*
|
|
1100
|
-
*
|
|
1186
|
+
* `process.stdout.write` is buffered by Node.js, which keeps the event loop from blocking on a
|
|
1187
|
+
* slow reader and also means the buffer grows without limit when the reader stalls. Pino does not
|
|
1188
|
+
* slow down for it, so the module bounds what this destination holds, through `queuedBytes` and
|
|
1189
|
+
* `destinationQueue.maxBytes`.
|
|
1101
1190
|
*/
|
|
1102
1191
|
declare class DefaultStdoutDestination implements ILogDestination {
|
|
1103
1192
|
readonly name = "stdout-json";
|
|
@@ -1110,6 +1199,13 @@ declare class DefaultStdoutDestination implements ILogDestination {
|
|
|
1110
1199
|
constructor(opts?: {
|
|
1111
1200
|
minLevel?: LogLevel;
|
|
1112
1201
|
});
|
|
1202
|
+
/**
|
|
1203
|
+
* The bytes `process.stdout` holds that have not reached its reader.
|
|
1204
|
+
*
|
|
1205
|
+
* @returns `process.stdout.writableLength`, in bytes since Node decodes a string chunk to a
|
|
1206
|
+
* buffer before queueing it.
|
|
1207
|
+
*/
|
|
1208
|
+
queuedBytes(): number;
|
|
1113
1209
|
/**
|
|
1114
1210
|
* Write a serialized JSON log entry (terminated with `\n`) to `stdout`.
|
|
1115
1211
|
*
|
|
@@ -1377,12 +1473,16 @@ declare class PrettyDevDestination implements ILogDestination {
|
|
|
1377
1473
|
*/
|
|
1378
1474
|
declare class HttpExceptionFilter implements ExceptionFilter {
|
|
1379
1475
|
private readonly logger;
|
|
1476
|
+
/** The host's own credential-segment patterns (`http.secretPathSegments`). */
|
|
1477
|
+
private readonly secretPathSegments;
|
|
1380
1478
|
/**
|
|
1381
1479
|
* @param logger - The structured logger exception entries are written to.
|
|
1382
1480
|
* Injected by token explicitly: the package is bundled without
|
|
1383
1481
|
* `emitDecoratorMetadata`, so implicit class-type injection would not resolve.
|
|
1482
|
+
* @param options - Resolved module options, read for `http.secretPathSegments`. Optional, so a
|
|
1483
|
+
* filter built by hand with the logger alone keeps the built-in credential patterns.
|
|
1384
1484
|
*/
|
|
1385
|
-
constructor(logger: PinoLoggerService);
|
|
1485
|
+
constructor(logger: PinoLoggerService, options?: ResolvedBymaxLoggerModuleOptions);
|
|
1386
1486
|
/**
|
|
1387
1487
|
* Log the exception at the status-appropriate level and write the JSON
|
|
1388
1488
|
* response.
|
|
@@ -1417,6 +1517,8 @@ declare class HttpLoggingInterceptor implements NestInterceptor {
|
|
|
1417
1517
|
private readonly logger;
|
|
1418
1518
|
/** Path patterns that bypass HTTP logging entirely (health checks, metrics). */
|
|
1419
1519
|
private readonly excludePaths;
|
|
1520
|
+
/** The host's own credential-segment patterns (`http.secretPathSegments`). */
|
|
1521
|
+
private readonly secretPathSegments;
|
|
1420
1522
|
/**
|
|
1421
1523
|
* @param logger - The structured logger the lifecycle entries are written to.
|
|
1422
1524
|
* Injected by token explicitly: the package is bundled without
|
|
@@ -1604,6 +1706,8 @@ declare class HttpAccessLogMiddleware implements NestMiddleware {
|
|
|
1604
1706
|
private readonly isEnabled;
|
|
1605
1707
|
/** Path patterns that bypass HTTP logging entirely (health checks, metrics). */
|
|
1606
1708
|
private readonly excludePaths;
|
|
1709
|
+
/** The host's own credential-segment patterns (`http.secretPathSegments`). */
|
|
1710
|
+
private readonly secretPathSegments;
|
|
1607
1711
|
/**
|
|
1608
1712
|
* @param logger - The structured logger the access entries are written to.
|
|
1609
1713
|
* Injected by token explicitly: the package is bundled without
|
|
@@ -1772,6 +1876,11 @@ interface UnexpectedErrorReport {
|
|
|
1772
1876
|
readonly correlationId?: string;
|
|
1773
1877
|
/** The active OpenTelemetry trace id. The key is absent when nothing is recording. */
|
|
1774
1878
|
readonly traceId?: string;
|
|
1879
|
+
/**
|
|
1880
|
+
* How many further occurrences of the same failure were withheld in the window that just ended.
|
|
1881
|
+
* Present only on the summary that closes a window; absent on a report of one occurrence.
|
|
1882
|
+
*/
|
|
1883
|
+
readonly repeated?: number;
|
|
1775
1884
|
}
|
|
1776
1885
|
/**
|
|
1777
1886
|
* A receiver for unexpected errors, called synchronously by nest-core's
|
package/dist/server/index.d.ts
CHANGED
|
@@ -173,6 +173,15 @@ interface ILogDestination {
|
|
|
173
173
|
* @param payload — Newline-terminated JSON entry, UTF-8 encoded.
|
|
174
174
|
*/
|
|
175
175
|
write(payload: string): void | PromiseLike<void>;
|
|
176
|
+
/**
|
|
177
|
+
* Optional: the bytes this destination holds in a buffer of its own that has not reached its
|
|
178
|
+
* medium yet. The module adds it to its own queue in front of the destination and drops an entry
|
|
179
|
+
* that would take the total past `destinationQueue.maxBytes`. Report only a buffer that grows
|
|
180
|
+
* when the medium stalls (a stream's write queue, a batch waiting to be sent). A destination that
|
|
181
|
+
* does not buffer, or does not define it, is bounded by the module's queue alone. A value that
|
|
182
|
+
* is not a finite number, or a throw, counts as `0`.
|
|
183
|
+
*/
|
|
184
|
+
queuedBytes?(): number;
|
|
176
185
|
/**
|
|
177
186
|
* Optional lifecycle hook — called once during NestJS module init.
|
|
178
187
|
* Use for opening connections, allocating buffers, scheduling flushers.
|
|
@@ -203,7 +212,8 @@ interface ILogDestination {
|
|
|
203
212
|
* @param status.heldEntriesDeliveredElsewhere - Whether another live sink
|
|
204
213
|
* accepted everything this destination accepted, as far as this library can
|
|
205
214
|
* see. `true` requires that sink to be not this one, initialized, at or below
|
|
206
|
-
* this level, with no write failure
|
|
215
|
+
* this level, with no write failure, no entry dropped for want of queue room and no write
|
|
216
|
+
* still in flight; anything
|
|
207
217
|
* less certain is `false`.
|
|
208
218
|
*
|
|
209
219
|
* **What it cannot see:** a write still QUEUED inside the `Writable` adapter,
|
|
@@ -391,6 +401,21 @@ interface HttpOptions {
|
|
|
391
401
|
* crafted URL into a ReDoS vector. The defaults are anchored and safe.
|
|
392
402
|
*/
|
|
393
403
|
excludePaths?: readonly RegExp[];
|
|
404
|
+
/**
|
|
405
|
+
* Patterns for path segments that carry a credential, in addition to the built-in ones.
|
|
406
|
+
*
|
|
407
|
+
* A reset, verification or invitation link puts its token in the path, where neither the query
|
|
408
|
+
* stripping nor key-name redaction can reach it. The logger replaces such a segment with
|
|
409
|
+
* `:redacted` in `url`, `fullUrl` and the path echoed in a not-found message, and keeps the rest
|
|
410
|
+
* of the route. Built in: a hex value of 32 or more digits, a JWT, an opaque token of 32 or more
|
|
411
|
+
* base64 or base64url characters that is not a slug, a snake_case name or a UUID, and a hex run of 32 or more digits inside a
|
|
412
|
+
* segment,
|
|
413
|
+
* and an email address; a file extension after a token is ignored.
|
|
414
|
+
*
|
|
415
|
+
* Each pattern is `.test()`-ed against ONE percent-decoded segment, so anchor it (`/^tok_/`) and
|
|
416
|
+
* keep it linear-time, as with {@link HttpOptions.excludePaths}. Default: none.
|
|
417
|
+
*/
|
|
418
|
+
secretPathSegments?: readonly RegExp[];
|
|
394
419
|
/**
|
|
395
420
|
* Header name carrying the tenant identifier, or `false` to read no header. Default:
|
|
396
421
|
* `x-tenant-id`.
|
|
@@ -419,6 +444,52 @@ interface HttpOptions {
|
|
|
419
444
|
type ResolvedHttpOptions = Required<Omit<HttpOptions, 'tenantIdResolver'>> & {
|
|
420
445
|
tenantIdResolver: HttpOptions['tenantIdResolver'];
|
|
421
446
|
};
|
|
447
|
+
/**
|
|
448
|
+
* The bound on the entries each destination may hold queued.
|
|
449
|
+
*
|
|
450
|
+
* Pino hands every entry to a destination whether or not the destination has taken the last one, so
|
|
451
|
+
* a destination slower than the application, or a stdout whose reader has stalled, queues without
|
|
452
|
+
* limit and the process grows until it is killed. Past the bound the module drops the NEW entry for
|
|
453
|
+
* that destination, counts it, and says so on stderr: a bounded loss with a signal, in place of
|
|
454
|
+
* growth without one.
|
|
455
|
+
*/
|
|
456
|
+
interface DestinationQueueOptions {
|
|
457
|
+
/**
|
|
458
|
+
* The most bytes one destination may hold queued, in UTF-8 bytes of the NDJSON lines. Default:
|
|
459
|
+
* 33554432 (32 MiB). An integer from 1024 to 2147483647, or `0` for no bound.
|
|
460
|
+
*
|
|
461
|
+
* The count is the module's own queue in front of the destination plus what the destination
|
|
462
|
+
* reports through `ILogDestination.queuedBytes`, which the default stdout destination does for
|
|
463
|
+
* `process.stdout`. An entry that would take the total past the bound is not written to that
|
|
464
|
+
* destination; the others still receive it. A stderr line says so, at most once every 10 seconds
|
|
465
|
+
* for each destination, with the number dropped and never an entry's content, and a last line at
|
|
466
|
+
* shutdown gives the total. `0` restores unbounded queues.
|
|
467
|
+
*/
|
|
468
|
+
maxBytes?: number;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* The time application shutdown has to flush the destinations.
|
|
472
|
+
*
|
|
473
|
+
* Shutdown first drains the queue each destination holds, then calls each destination's
|
|
474
|
+
* `onShutdown` in reverse registration order. The whole sequence is bounded by `timeoutMs`, whatever
|
|
475
|
+
* the number of destinations: a destination reached after the budget is spent is reported as skipped
|
|
476
|
+
* and its `onShutdown` is not called.
|
|
477
|
+
*/
|
|
478
|
+
interface ShutdownOptions {
|
|
479
|
+
/**
|
|
480
|
+
* The total budget of shutdown, in milliseconds, covering the drain and every `onShutdown`.
|
|
481
|
+
* Default: 10000. An integer from 1 to 2147483647. Keep it below the grace period your platform
|
|
482
|
+
* gives the process, together with whatever else shuts down in it.
|
|
483
|
+
*/
|
|
484
|
+
timeoutMs?: number;
|
|
485
|
+
/**
|
|
486
|
+
* How long the drain may take, in milliseconds. Default: 5000. An integer from 1 to
|
|
487
|
+
* 2147483647, and not above `timeoutMs`. When it ends with entries still queued, one line naming
|
|
488
|
+
* the destinations and their queued sizes is written to stderr and shutdown goes on to
|
|
489
|
+
* `onShutdown`.
|
|
490
|
+
*/
|
|
491
|
+
drainTimeoutMs?: number;
|
|
492
|
+
}
|
|
422
493
|
/**
|
|
423
494
|
* OpenTelemetry integration tuning — applied by `TraceContextMixin` when the
|
|
424
495
|
* `@opentelemetry/api` peer dependency is installed.
|
|
@@ -549,6 +620,21 @@ interface BymaxLoggerModuleOptions {
|
|
|
549
620
|
otel?: OtelOptions;
|
|
550
621
|
/** Maximum size in bytes per log entry. Default: 65536. */
|
|
551
622
|
maxEntrySizeBytes?: number;
|
|
623
|
+
/**
|
|
624
|
+
* The longest a destination's `onInit` or `onRegistryReady` may take, in milliseconds. Default:
|
|
625
|
+
* 10000. An integer from 1 to 2147483647 (the largest delay a timer holds).
|
|
626
|
+
*
|
|
627
|
+
* An `onInit` that does not settle in time is treated as one that threw: the destination is
|
|
628
|
+
* marked failed, skipped and reported on stderr, and if the abandoned call settles later the
|
|
629
|
+
* destination stays inactive, receives no writes and no `onShutdown`. The call cannot be
|
|
630
|
+
* cancelled, so a hung `onInit` may leak what it opened. An `onRegistryReady` that does not
|
|
631
|
+
* settle in time is reported and bootstrap goes on.
|
|
632
|
+
*/
|
|
633
|
+
destinationHookTimeoutMs?: number;
|
|
634
|
+
/** How long application shutdown may take to flush the destinations. */
|
|
635
|
+
shutdown?: ShutdownOptions;
|
|
636
|
+
/** How much each destination may hold queued before the module drops entries. */
|
|
637
|
+
destinationQueue?: DestinationQueueOptions;
|
|
552
638
|
/**
|
|
553
639
|
* Which of an error's own fields are written beside its `type`, `message`, `stack` and `cause`.
|
|
554
640
|
*
|
|
@@ -583,9 +669,11 @@ interface BymaxLoggerModuleOptions {
|
|
|
583
669
|
* middleware) consumes — distinct from the loosely-typed
|
|
584
670
|
* `BymaxLoggerModuleOptions` the consumer supplies.
|
|
585
671
|
*/
|
|
586
|
-
type ResolvedBymaxLoggerModuleOptions = Readonly<Required<Omit<BymaxLoggerModuleOptions, 'http' | 'otel'>> & {
|
|
672
|
+
type ResolvedBymaxLoggerModuleOptions = Readonly<Required<Omit<BymaxLoggerModuleOptions, 'http' | 'otel' | 'shutdown' | 'destinationQueue'>> & {
|
|
587
673
|
http: ResolvedHttpOptions;
|
|
588
674
|
otel: Required<OtelOptions>;
|
|
675
|
+
shutdown: Required<ShutdownOptions>;
|
|
676
|
+
destinationQueue: Required<DestinationQueueOptions>;
|
|
589
677
|
}>;
|
|
590
678
|
/**
|
|
591
679
|
* Factory interface used by `useExisting` / `useClass` async wiring.
|
|
@@ -1095,9 +1183,10 @@ declare class LogContextService {
|
|
|
1095
1183
|
/**
|
|
1096
1184
|
* Canonical destination that writes log payloads to `process.stdout`.
|
|
1097
1185
|
*
|
|
1098
|
-
* `process.stdout.write` is buffered by Node.js, which
|
|
1099
|
-
*
|
|
1100
|
-
*
|
|
1186
|
+
* `process.stdout.write` is buffered by Node.js, which keeps the event loop from blocking on a
|
|
1187
|
+
* slow reader and also means the buffer grows without limit when the reader stalls. Pino does not
|
|
1188
|
+
* slow down for it, so the module bounds what this destination holds, through `queuedBytes` and
|
|
1189
|
+
* `destinationQueue.maxBytes`.
|
|
1101
1190
|
*/
|
|
1102
1191
|
declare class DefaultStdoutDestination implements ILogDestination {
|
|
1103
1192
|
readonly name = "stdout-json";
|
|
@@ -1110,6 +1199,13 @@ declare class DefaultStdoutDestination implements ILogDestination {
|
|
|
1110
1199
|
constructor(opts?: {
|
|
1111
1200
|
minLevel?: LogLevel;
|
|
1112
1201
|
});
|
|
1202
|
+
/**
|
|
1203
|
+
* The bytes `process.stdout` holds that have not reached its reader.
|
|
1204
|
+
*
|
|
1205
|
+
* @returns `process.stdout.writableLength`, in bytes since Node decodes a string chunk to a
|
|
1206
|
+
* buffer before queueing it.
|
|
1207
|
+
*/
|
|
1208
|
+
queuedBytes(): number;
|
|
1113
1209
|
/**
|
|
1114
1210
|
* Write a serialized JSON log entry (terminated with `\n`) to `stdout`.
|
|
1115
1211
|
*
|
|
@@ -1377,12 +1473,16 @@ declare class PrettyDevDestination implements ILogDestination {
|
|
|
1377
1473
|
*/
|
|
1378
1474
|
declare class HttpExceptionFilter implements ExceptionFilter {
|
|
1379
1475
|
private readonly logger;
|
|
1476
|
+
/** The host's own credential-segment patterns (`http.secretPathSegments`). */
|
|
1477
|
+
private readonly secretPathSegments;
|
|
1380
1478
|
/**
|
|
1381
1479
|
* @param logger - The structured logger exception entries are written to.
|
|
1382
1480
|
* Injected by token explicitly: the package is bundled without
|
|
1383
1481
|
* `emitDecoratorMetadata`, so implicit class-type injection would not resolve.
|
|
1482
|
+
* @param options - Resolved module options, read for `http.secretPathSegments`. Optional, so a
|
|
1483
|
+
* filter built by hand with the logger alone keeps the built-in credential patterns.
|
|
1384
1484
|
*/
|
|
1385
|
-
constructor(logger: PinoLoggerService);
|
|
1485
|
+
constructor(logger: PinoLoggerService, options?: ResolvedBymaxLoggerModuleOptions);
|
|
1386
1486
|
/**
|
|
1387
1487
|
* Log the exception at the status-appropriate level and write the JSON
|
|
1388
1488
|
* response.
|
|
@@ -1417,6 +1517,8 @@ declare class HttpLoggingInterceptor implements NestInterceptor {
|
|
|
1417
1517
|
private readonly logger;
|
|
1418
1518
|
/** Path patterns that bypass HTTP logging entirely (health checks, metrics). */
|
|
1419
1519
|
private readonly excludePaths;
|
|
1520
|
+
/** The host's own credential-segment patterns (`http.secretPathSegments`). */
|
|
1521
|
+
private readonly secretPathSegments;
|
|
1420
1522
|
/**
|
|
1421
1523
|
* @param logger - The structured logger the lifecycle entries are written to.
|
|
1422
1524
|
* Injected by token explicitly: the package is bundled without
|
|
@@ -1604,6 +1706,8 @@ declare class HttpAccessLogMiddleware implements NestMiddleware {
|
|
|
1604
1706
|
private readonly isEnabled;
|
|
1605
1707
|
/** Path patterns that bypass HTTP logging entirely (health checks, metrics). */
|
|
1606
1708
|
private readonly excludePaths;
|
|
1709
|
+
/** The host's own credential-segment patterns (`http.secretPathSegments`). */
|
|
1710
|
+
private readonly secretPathSegments;
|
|
1607
1711
|
/**
|
|
1608
1712
|
* @param logger - The structured logger the access entries are written to.
|
|
1609
1713
|
* Injected by token explicitly: the package is bundled without
|
|
@@ -1772,6 +1876,11 @@ interface UnexpectedErrorReport {
|
|
|
1772
1876
|
readonly correlationId?: string;
|
|
1773
1877
|
/** The active OpenTelemetry trace id. The key is absent when nothing is recording. */
|
|
1774
1878
|
readonly traceId?: string;
|
|
1879
|
+
/**
|
|
1880
|
+
* How many further occurrences of the same failure were withheld in the window that just ended.
|
|
1881
|
+
* Present only on the summary that closes a window; absent on a report of one occurrence.
|
|
1882
|
+
*/
|
|
1883
|
+
readonly repeated?: number;
|
|
1775
1884
|
}
|
|
1776
1885
|
/**
|
|
1777
1886
|
* A receiver for unexpected errors, called synchronously by nest-core's
|