@bymax-one/nest-logger 1.4.31 → 1.4.33
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 +23 -1
- package/README.md +54 -49
- package/dist/server/index.cjs +3 -3
- package/dist/server/index.d.cts +9 -9
- package/dist/server/index.d.ts +9 -9
- package/dist/server/index.mjs +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,26 @@ heading here.
|
|
|
12
12
|
|
|
13
13
|
## [Unreleased]
|
|
14
14
|
|
|
15
|
+
## [1.4.33] - 2026-11-27
|
|
16
|
+
|
|
17
|
+
No behaviour change: the published code differs from `1.4.32` in one comment.
|
|
18
|
+
|
|
19
|
+
### Documentation
|
|
20
|
+
|
|
21
|
+
- **`minLevel` of `DefaultStdoutDestination` says what omitting it does.** The destination then receives what the module `level` lets through, and a `minLevel` below that level widens nothing.
|
|
22
|
+
- **The `1.4.32` entry on the README says what it filled**: gaps against the behaviour as well as against the types.
|
|
23
|
+
|
|
24
|
+
## [1.4.32] - 2026-11-26
|
|
25
|
+
|
|
26
|
+
### Documentation
|
|
27
|
+
|
|
28
|
+
- **Every log key is listed with its level and fields.** `LOGGER_BOOTSTRAP_OK` and `LOGGER_SHUTDOWN_OK` had no row, and `LOGGER_BUILTINS_REPLACED` is now listed under thrown errors.
|
|
29
|
+
- **The README fills gaps it had against the published types and the behaviour**, in the options, the HTTP fields, the decorators, the helpers and the destinations.
|
|
30
|
+
- **The row for `censorMessageText` is removed.** The method is marked `@internal`.
|
|
31
|
+
- **The comments on `ILogDestination` match the registry**, on write failure reports and on the shutdown budget.
|
|
32
|
+
|
|
33
|
+
No code change: against the published 1.4.31, the JavaScript in `dist/` is identical and the type declarations differ only in comments.
|
|
34
|
+
|
|
15
35
|
## [1.4.31] - 2026-11-25
|
|
16
36
|
|
|
17
37
|
### Changed
|
|
@@ -3575,7 +3595,9 @@ published `dist/` is identical — no runtime behaviour changes for consumers.
|
|
|
3575
3595
|
- Professional CI suite: `ci.yml`, `bench.yml`, `codeql.yml`, `scorecard.yml`,
|
|
3576
3596
|
`release.yml`, Dependabot, and issue templates
|
|
3577
3597
|
|
|
3578
|
-
[Unreleased]: https://github.com/bymaxone/nest-logger/compare/v1.4.
|
|
3598
|
+
[Unreleased]: https://github.com/bymaxone/nest-logger/compare/v1.4.33...HEAD
|
|
3599
|
+
[1.4.33]: https://github.com/bymaxone/nest-logger/compare/v1.4.32...v1.4.33
|
|
3600
|
+
[1.4.32]: https://github.com/bymaxone/nest-logger/compare/v1.4.31...v1.4.32
|
|
3579
3601
|
[1.4.31]: https://github.com/bymaxone/nest-logger/compare/v1.4.30...v1.4.31
|
|
3580
3602
|
[1.4.30]: https://github.com/bymaxone/nest-logger/compare/v1.4.29...v1.4.30
|
|
3581
3603
|
[1.4.29]: https://github.com/bymaxone/nest-logger/compare/v1.4.28...v1.4.29
|
package/README.md
CHANGED
|
@@ -271,7 +271,7 @@ A key that holds `undefined` or `null` is read as not set, in the options and in
|
|
|
271
271
|
| `eventNameField` | `string \| false` | `'event.name'` | Field carrying the derived event name (`PAYMENT_FAILED` → `payment.failed`). `false` disables it |
|
|
272
272
|
| `errorFormat` | `'pino' \| 'semconv' \| 'both'` | `'pino'` | `'both'` adds `exception.*` and `error.type` beside `err.*`; `'semconv'` replaces them |
|
|
273
273
|
| `level` | `LogLevel` | `'info'` when `NODE_ENV=production`, else `'debug'` | Minimum log level. One of `fatal \| error \| warn \| info \| debug \| trace`, in lower case. Anything else, such as Pino's `silent`, `'FATAL'` or a numeric level, makes `forRoot` throw when it is called, and `forRootAsync` throw at bootstrap |
|
|
274
|
-
| `redactPaths` | `string[]` | `[]` | Additional `fast-redact` paths, applied on top of the default coverage
|
|
274
|
+
| `redactPaths` | `string[]` | `[]` | Additional `fast-redact` paths (each at most 256 characters), applied on top of the default coverage |
|
|
275
275
|
| `redactStrategy` | `'names' \| 'paths'` | `'names'` | Engine behind the DEFAULT set. `'paths'` is the legacy `fast-redact` expansion (four-level ceiling, much slower) |
|
|
276
276
|
| `shouldDisableDefaultRedact` | `boolean` | `false` | Skip the default PII coverage entirely. ⚠️ Emits `LOGGER_BOOTSTRAP_WARNING` at startup — document why |
|
|
277
277
|
| `redactCensor` | `string` | `'[REDACTED]'` | Replacement value written in place of every redacted field |
|
|
@@ -325,10 +325,10 @@ A key that holds `undefined` or `null` is read as not set, in the options and in
|
|
|
325
325
|
|
|
326
326
|
Shutdown first drains the queue each destination holds, and for the default stdout destination also what `process.stdout` has not yet handed to its reader, then calls each destination's `onShutdown` in reverse registration order. One budget covers the drain and every `onShutdown`, so the worst case is `shutdown.timeoutMs`, whatever the number of destinations. A destination reached after the budget is spent is named in one stderr line and its `onShutdown` is not called. Keep the budget below the grace period your platform gives the process, together with whatever else shuts down in it. Entries logged after the drain ended, by a host that logs in its own shutdown hook, are not waited for. Keep `shutdown.drainTimeoutMs` below `shutdown.timeoutMs`: a drain equal to the total, and a short total whose default drain is capped to it, leave no time for `onShutdown` when a queue never empties, and every `onShutdown` is then skipped and named.
|
|
327
327
|
|
|
328
|
-
| Option | Type | Default | Description
|
|
329
|
-
| ------------------------- | -------- | ------- |
|
|
330
|
-
| `shutdown.timeoutMs` | `number` | `10000` | Total shutdown budget in ms, covering the drain and every `onShutdown` (an integer from 1 to 2147483647)
|
|
331
|
-
| `shutdown.drainTimeoutMs` | `number` | `5000` | Longest the drain may take, in ms, and not above `shutdown.timeoutMs`. When it ends with entries still queued, one stderr line names the destinations and the size of what each holds, and shutdown goes on |
|
|
328
|
+
| Option | Type | Default | Description |
|
|
329
|
+
| ------------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
330
|
+
| `shutdown.timeoutMs` | `number` | `10000` | Total shutdown budget in ms, covering the drain and every `onShutdown` (an integer from 1 to 2147483647) |
|
|
331
|
+
| `shutdown.drainTimeoutMs` | `number` | `5000` | Longest the drain may take, in ms, and not above `shutdown.timeoutMs`; left unset it is `timeoutMs` when that is below `5000`. When it ends with entries still queued, one stderr line names the destinations and the size of what each holds, and shutdown goes on |
|
|
332
332
|
|
|
333
333
|
### `destinationQueue` options
|
|
334
334
|
|
|
@@ -367,7 +367,7 @@ Set `http.isEnabled: true`, then wire the access log with `applyAccessLog(app)`
|
|
|
367
367
|
| `HTTP_EXCEPTION_HANDLED` | `HttpException` below 500, or a thrown value that exposes a 4xx status, caught by the filter (`warn`) |
|
|
368
368
|
| `HTTP_EXCEPTION_UNHANDLED` | `HttpException` of 500 or more, or any other thrown value, caught by the filter (`error`) |
|
|
369
369
|
|
|
370
|
-
The levels are `info` for `HTTP_REQUEST_START`, `HTTP_REQUEST_SUCCESS` and `HTTP_REQUEST_REDIRECT`, `warn` for `HTTP_REQUEST_CLIENT_ERROR` and `HTTP_REQUEST_ABORTED`, and `error` for `HTTP_REQUEST_SERVER_ERROR`. A terminal entry carries `method`, `url`, `statusCode` and `duration`; a 4xx
|
|
370
|
+
The levels are `info` for `HTTP_REQUEST_START`, `HTTP_REQUEST_SUCCESS` and `HTTP_REQUEST_REDIRECT`, `warn` for `HTTP_REQUEST_CLIENT_ERROR` and `HTTP_REQUEST_ABORTED`, and `error` for `HTTP_REQUEST_SERVER_ERROR`. `HTTP_REQUEST_START` carries `method`, `url`, `fullUrl`, `ip` and `userAgent` (`ip` is personal data). `HTTP_REQUEST_SERVER_ERROR` and `HTTP_EXCEPTION_UNHANDLED` carry the error as `err`. A terminal entry carries `method`, `url`, `statusCode` and `duration`; a 4xx thrown by a pipe or the handler adds `errorMessage`, and a 5xx that neither of them threw is logged with a synthesized `Error`. The exception entries carry `method`, `url` and `status`, and `bodyParserType` for some body-parser refusals.
|
|
371
371
|
|
|
372
372
|
`HTTP_REQUEST_START` is emitted **before guards**, so it carries no `userId`: authentication runs in a guard and there is no principal yet. The acting user is on the terminal entry. Both entries carry the same `requestId`.
|
|
373
373
|
|
|
@@ -743,6 +743,8 @@ BymaxLoggerModule.forRootAsync({
|
|
|
743
743
|
|
|
744
744
|
A non-empty `destinations` **replaces** `DefaultStdoutDestination`, so a file-only or socket-only deployment can turn structured stdout off. To keep stdout beside a custom sink, list it explicitly: `destinations: [new DefaultStdoutDestination(), new LokiDestination({ ... })]`.
|
|
745
745
|
|
|
746
|
+
`new DefaultStdoutDestination({ minLevel })` takes an optional minimum level; without one the module `level` applies. Its `name`, which `stderr` reports use, is `stdout-json`; `PrettyDevDestination` is named `pretty-dev`.
|
|
747
|
+
|
|
746
748
|
A sink you supply may be the only one the application has, so two guarantees cover its failure: a destination that fails `onInit` is reported as `LOGGER_DESTINATION_INIT_FAILED` on `stderr` (not through the logger, whose sinks just failed) and receives no entries, and if **every** destination fails to initialize, entries fall back to raw NDJSON on `stdout`. Adding `new PrettyDevDestination()` without the optional `pino-pretty` therefore costs colours and a line on stderr, never your logs.
|
|
747
749
|
|
|
748
750
|
### Choosing how the dev terminal renders
|
|
@@ -1074,12 +1076,11 @@ Implements NestJS `LoggerService`. All methods are available via `@InjectLogger(
|
|
|
1074
1076
|
|
|
1075
1077
|
**Helpers**
|
|
1076
1078
|
|
|
1077
|
-
| Method
|
|
1078
|
-
|
|
|
1079
|
-
| `child`
|
|
1080
|
-
| `setContext`
|
|
1081
|
-
| `getRawLogger`
|
|
1082
|
-
| `censorMessageText` | `(text)` | The text with the censor of the `message` of an entry applied (`redactPaths`, `redactCensor`); use it before writing a free-text error to a channel the library does not own |
|
|
1079
|
+
| Method | Signature | Notes |
|
|
1080
|
+
| -------------- | ------------ | ----------------------------------------------------------------- |
|
|
1081
|
+
| `child` | `(bindings)` | New `PinoLoggerService` over a Pino child logger |
|
|
1082
|
+
| `setContext` | `(context)` | Global label — ⚠️ singleton; prefer `@InjectLogger(MyClass.name)` |
|
|
1083
|
+
| `getRawLogger` | `()` | The underlying Pino instance; bypasses the `meta` guards above |
|
|
1083
1084
|
|
|
1084
1085
|
> [!NOTE]
|
|
1085
1086
|
> There is no `fatalStructured` / `debugStructured`. Structured `fatal` and `debug` helpers are out of scope until a consumer needs them; use `getRawLogger()` in the meantime.
|
|
@@ -1098,11 +1099,11 @@ Implements NestJS `LoggerService`. All methods are available via `@InjectLogger(
|
|
|
1098
1099
|
|
|
1099
1100
|
### Decorators
|
|
1100
1101
|
|
|
1101
|
-
| Decorator | Target | Description
|
|
1102
|
-
| ------------------------------- | ----------------- |
|
|
1103
|
-
| `@InjectLogger(context?)` | Constructor param | Injects `PinoLoggerService` pre-bound to the given context string
|
|
1104
|
-
| `@LogContext(name)` | Class | **Deprecated.** Records a context label as class metadata that nothing in this package reads, so the label is never applied, and it does NOT open a `logContext.run()` scope. Use `@InjectLogger(MyClass.name)` for a per-class label
|
|
1105
|
-
| `@LogPerformance(thresholdMs?)` | Method | Logs `METHOD_EXECUTION` (`info`, fields `method` and `duration`) on completion; `METHOD_SLOW_EXECUTION` (`warn`, plus `thresholdMs`) if the duration is strictly greater than the threshold (1000 ms by default); the wrapped method always returns a `Promise`, so apply it to async methods. The threshold must be a finite number of zero or more (a `TypeError` at class definition otherwise) |
|
|
1102
|
+
| Decorator | Target | Description |
|
|
1103
|
+
| ------------------------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1104
|
+
| `@InjectLogger(context?)` | Constructor param | Injects `PinoLoggerService` pre-bound to the given context string. A class that names a context must be imported before the `forRoot` / `forRootAsync` call is evaluated, which is when the contexts are collected |
|
|
1105
|
+
| `@LogContext(name)` | Class | **Deprecated.** Records a context label as class metadata that nothing in this package reads, so the label is never applied, and it does NOT open a `logContext.run()` scope. Use `@InjectLogger(MyClass.name)` for a per-class label |
|
|
1106
|
+
| `@LogPerformance(thresholdMs?)` | Method | Logs `METHOD_EXECUTION` (`info`, fields `method` and `duration`) on completion; `METHOD_SLOW_EXECUTION` (`warn`, plus `thresholdMs`) instead if the duration is strictly greater than the threshold (1000 ms by default); the wrapped method always returns a `Promise`, so apply it to async methods. The threshold must be a finite number of zero or more (a `TypeError` at class definition otherwise). A call that throws or rejects is logged the same way, with no outcome field, and the error is rethrown. The instance must hold a `PinoLoggerService` in a property named `logger`: without one, nothing is logged and no error is raised |
|
|
1106
1107
|
|
|
1107
1108
|
### Injection tokens and helpers
|
|
1108
1109
|
|
|
@@ -1122,12 +1123,12 @@ Every token is a `Symbol`, never a string, so it cannot collide with one of your
|
|
|
1122
1123
|
|
|
1123
1124
|
### Application helpers
|
|
1124
1125
|
|
|
1125
|
-
| Helper
|
|
1126
|
-
|
|
|
1127
|
-
| `BymaxLoggerModule.useNestLogger(app)`
|
|
1128
|
-
| `BymaxLoggerModule.useRequestContext(app)`
|
|
1129
|
-
| `applyAccessLog(app)`
|
|
1130
|
-
| `applyRequestIdMiddleware(consumer)`
|
|
1126
|
+
| Helper | When to call it | Throws or stays silent |
|
|
1127
|
+
| --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
1128
|
+
| `BymaxLoggerModule.useNestLogger(app)` | right after `NestFactory.create(AppModule, { bufferLogs: true })`; it calls `app.useLogger(logger)` and then `app.flushLogs()` | throws `[BymaxLoggerModule] useNestLogger(app) called but BymaxLoggerModule was not imported`, with the original error as `cause` |
|
|
1129
|
+
| `BymaxLoggerModule.useRequestContext(app)` | before `app.init()`, when only the correlation scope is wanted | mounts the scope alone, with no access log |
|
|
1130
|
+
| `applyAccessLog(app)` | before `app.init()` (or before `app.listen()` when `init()` is not called by you); it mounts the correlation scope and the access log together, ahead of the body parser | throws when the module was not imported. With `http.isEnabled` off it still opens the scope and writes no access entries. A mount after `init()` is not rejected: it mounts behind the parser and the router, and a request the parser refuses or no route matches gets no access entry, with no error |
|
|
1131
|
+
| `applyRequestIdMiddleware(consumer, routes?)` | in `configure(consumer)` of a module | mounts the request-id scope and the access log through the Nest middleware consumer, on `routes` (default `/`, every route) |
|
|
1131
1132
|
|
|
1132
1133
|
### Option and context types (from `@bymax-one/nest-logger`)
|
|
1133
1134
|
|
|
@@ -1237,40 +1238,44 @@ interface ILogDestination {
|
|
|
1237
1238
|
|
|
1238
1239
|
## 🚨 Error Code Catalog
|
|
1239
1240
|
|
|
1240
|
-
Two kinds of failure, and they surface differently. A **thrown `Error`** carries no code
|
|
1241
|
+
Two kinds of failure, and they surface differently. A **thrown `Error`** carries no code field: it carries a message prefixed with the emitting class, which is what you match on (`LOGGER_BUILTINS_REPLACED` is the whole message). A **log key** is a code you can filter on: it is the `logKey` of an entry or of a `stderr` line, or the `_logKey` of an envelope inside an entry.
|
|
1241
1242
|
|
|
1242
1243
|
### Thrown errors
|
|
1243
1244
|
|
|
1244
|
-
| Message starts with | Thrown from
|
|
1245
|
-
| -------------------------------------------------------- |
|
|
1246
|
-
| `[BymaxLoggerModule] options.` | `forRoot` / `forRootAsync`, at module setup
|
|
1247
|
-
| `
|
|
1248
|
-
| `
|
|
1249
|
-
| `
|
|
1250
|
-
| `[BymaxLoggerModule]
|
|
1251
|
-
| `[BymaxLoggerModule]
|
|
1252
|
-
| `[
|
|
1253
|
-
| `[PrettyDevDestination] pino-pretty is not installed` | `PrettyDevDestination.onInit`
|
|
1254
|
-
| `[PrettyDevDestination] pino-pretty failed to start` | `PrettyDevDestination.onInit`
|
|
1255
|
-
| `[PrettyDevDestination] refused in production` | `PrettyDevDestination.onInit`
|
|
1256
|
-
| `[LogContextService] set() called outside run() scope` | `LogContextService.set`
|
|
1257
|
-
| `[LogContextService] Refusing to set unsafe context key` | `LogContextService.set`
|
|
1245
|
+
| Message starts with | Thrown from | When | Action |
|
|
1246
|
+
| -------------------------------------------------------- | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
|
|
1247
|
+
| `[BymaxLoggerModule] options.` | `forRoot` / `forRootAsync`, at module setup | any option fails validation: a missing `service`, a `level` outside the set, a bad type, a list option with more than 10000 entries or a length that is not a count, an option object with more than 256 prototypes | Fix the option the message names |
|
|
1248
|
+
| `LOGGER_BUILTINS_REPLACED` | `forRoot` / `forRootAsync`, and when the logger is built | a built-in the logger reads names with was replaced after the library was loaded | Remove the patch, or apply it before the library is imported |
|
|
1249
|
+
| `[BymaxLoggerModule] options could not be read` | `forRoot` / `forRootAsync`, at module setup | an option the host supplies threw when it was read (a getter or a Proxy trap) | Fix the option; the error the host threw is the `cause` |
|
|
1250
|
+
| `[BymaxLoggerModule] useNestLogger(app) called but` | `BymaxLoggerModule.useNestLogger` | the module was never imported into the application | Import `BymaxLoggerModule` before calling it |
|
|
1251
|
+
| `[BymaxLoggerModule] applyAccessLog(app) called but` | `applyAccessLog` | the module was never imported into the application | Import `BymaxLoggerModule` before calling it |
|
|
1252
|
+
| `[BymaxLoggerModule] useRequestContext(app) called but` | `useRequestContext` | the module was never imported into the application | Import `BymaxLoggerModule` before calling it |
|
|
1253
|
+
| `[LogPerformance] thresholdMs must be` | `@LogPerformance`, at class definition | the threshold is not a finite number of zero or more (a `TypeError`) | Pass a finite number of milliseconds |
|
|
1254
|
+
| `[PrettyDevDestination] pino-pretty is not installed` | `PrettyDevDestination.onInit` | the destination is registered and resolving `pino-pretty` itself fails | Install `pino-pretty` or drop the destination |
|
|
1255
|
+
| `[PrettyDevDestination] pino-pretty failed to start` | `PrettyDevDestination.onInit` | `pino-pretty` is found but importing it or building the transform throws | Read the message and the error's `cause`: it is the real failure |
|
|
1256
|
+
| `[PrettyDevDestination] refused in production` | `PrettyDevDestination.onInit` | `NODE_ENV` is exactly `production` | Use `DefaultStdoutDestination` in production |
|
|
1257
|
+
| `[LogContextService] set() called outside run() scope` | `LogContextService.set` | called with no active `run()` | Wrap the work in `logContext.run({ ... }, () => ...)` |
|
|
1258
|
+
| `[LogContextService] Refusing to set unsafe context key` | `LogContextService.set` | the key is `__proto__`, `constructor` or `prototype` | Use an ordinary key |
|
|
1258
1259
|
|
|
1259
1260
|
The `PrettyDevDestination` errors are thrown inside `onInit`, which the registry contains: the boot continues and the failure is reported as `LOGGER_DESTINATION_INIT_FAILED` below.
|
|
1260
1261
|
|
|
1261
1262
|
### Log keys
|
|
1262
1263
|
|
|
1263
|
-
| Code | Surfaces as
|
|
1264
|
-
| ------------------------------------ |
|
|
1265
|
-
| `
|
|
1266
|
-
| `
|
|
1267
|
-
| `
|
|
1268
|
-
| `
|
|
1269
|
-
| `
|
|
1270
|
-
| `
|
|
1271
|
-
| `
|
|
1272
|
-
| `
|
|
1273
|
-
| `
|
|
1264
|
+
| Code | Level | Surfaces as | Fields | When | Action |
|
|
1265
|
+
| ------------------------------------ | ----------- | ----------------------------- | --------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
|
|
1266
|
+
| `LOGGER_BOOTSTRAP_OK` | `info` | log entry | none of its own | every `onInit` and `onRegistryReady` has settled or timed out, failed or not | None. Written once |
|
|
1267
|
+
| `LOGGER_SHUTDOWN_OK` | `info` | log entry | `destinations` (the number about to be closed) | shutdown starts, before any `onShutdown` | None. Where `info` is written, its absence means the process was killed rather than shut down |
|
|
1268
|
+
| `LOGGER_DESTINATION_INIT_FAILED` | `error` | NDJSON line on `stderr` | `destination`, `err` (`type`, `message`), `msg` | `destination.onInit()` or `destination.onRegistryReady()` throws, rejects or exceeds `destinationHookTimeoutMs` (a destination whose `onInit` succeeded keeps receiving entries) | A sink whose `onInit` failed is removed from the write fan-out and shutdown; boot continues |
|
|
1269
|
+
| `LOGGER_DESTINATION_SHUTDOWN_FAILED` | `error` | NDJSON line on `stderr` | `destination`, `err`, `msg` | `destination.onShutdown()` throws, rejects or does not settle within the shutdown budget | Anything the sink still held is lost |
|
|
1270
|
+
| `LOGGER_DESTINATION_WRITE_FAILED` | `error` | NDJSON line on `stderr` | `destination`, `err`, `msg`, and `suppressed` (failures not reported since the last line) when above zero | `destination.write()` throws or rejects | Entry dropped for that destination; others continue |
|
|
1271
|
+
| `HTTP_UNEXPECTED_ERROR_DROPPED` | `error` | NDJSON line on `stderr` | `destination` (`PinoUnexpectedErrorSink`), `err`, `msg` | `PinoUnexpectedErrorSink` could not log a report (the logger threw, or the report could not be read) | The report is dropped; the line names why. The response is unaffected |
|
|
1272
|
+
| `LOGGER_OTEL_API_BROKEN` | `warn` | NDJSON line on `stderr`, once | `err`, `msg` | `@opentelemetry/api` is installed but unusable | Reinstall it, or turn `otel.shouldAutoInjectTraceContext` off; until then `traceId` and `spanId` are absent |
|
|
1273
|
+
| `LOGGER_BOOTSTRAP_WARNING` | `warn` | log entry | `reason: 'OTEL_API_UNAVAILABLE'`, `shouldAutoInjectTraceContext: true` | `otel.shouldAutoInjectTraceContext` is on and `@opentelemetry/api` cannot be loaded | Install `@opentelemetry/api`, or turn the option off; until then `traceId` and `spanId` are absent |
|
|
1274
|
+
| `LOGGER_BOOTSTRAP_WARNING` | `warn` | log entry | `shouldDisableDefaultRedact: true`, `redactPathCount` | `shouldDisableDefaultRedact` is on | None; the entry exists so a security review can audit it |
|
|
1275
|
+
| `LOGGER_ENTRY_TRUNCATED` | the entry's | `_logKey` in the envelope | `_truncated`, `_originalSize` (`-1` when it could not be measured), `_preview`, in place of the field | a serialized field exceeds `maxEntrySizeBytes` or cannot be measured | Reduce the payload or raise the ceiling |
|
|
1276
|
+
| `LOGGER_REDACTION_FAILED` | the entry's | `_logKey` in the envelope | `_redactionFailed: true` | a record cannot be walked by the redactor (a throwing getter, a hostile proxy in the metadata) | The record is dropped whole, never partly emitted; the message stays. Find the value that broke the walk |
|
|
1277
|
+
|
|
1278
|
+
Some `stderr` reports are plain text, carry no key and start with `[DestinationRegistry]`: a full destination queue (with the entries dropped since the last report), the totals of dropped entries and of failed writes at shutdown, a drain that ended with entries still queued, and the destinations whose `onShutdown` was not called because the shutdown budget was spent.
|
|
1274
1279
|
|
|
1275
1280
|
---
|
|
1276
1281
|
|
package/dist/server/index.cjs
CHANGED
|
@@ -1940,9 +1940,9 @@ function writeStderrSafely(line) {
|
|
|
1940
1940
|
// src/server/destinations/default-stdout.destination.ts
|
|
1941
1941
|
exports.DefaultStdoutDestination = class DefaultStdoutDestination {
|
|
1942
1942
|
/**
|
|
1943
|
-
* @param opts.minLevel — Optional minimum level
|
|
1944
|
-
*
|
|
1945
|
-
*
|
|
1943
|
+
* @param opts.minLevel — Optional minimum level for this destination. Entries
|
|
1944
|
+
* below it, or below the module `level`, never reach `write`. Omit (or pass
|
|
1945
|
+
* `undefined`) to receive what the module `level` lets through.
|
|
1946
1946
|
*/
|
|
1947
1947
|
constructor(opts = {}) {
|
|
1948
1948
|
this.name = "stdout-json";
|
package/dist/server/index.d.cts
CHANGED
|
@@ -163,10 +163,10 @@ interface ILogDestination {
|
|
|
163
163
|
* - Return a Promise for async I/O
|
|
164
164
|
*
|
|
165
165
|
* Errors thrown here, and rejections of a returned promise, are caught by the
|
|
166
|
-
* library: the entry is dropped for this destination only
|
|
167
|
-
*
|
|
168
|
-
* breaker, so a destination that initialized and keeps failing keeps
|
|
169
|
-
* entries
|
|
166
|
+
* library: the entry is dropped for this destination only. Failure lines on stderr
|
|
167
|
+
* are throttled to one a window for each destination, and shutdown writes the total when more than one write failed. There is no
|
|
168
|
+
* retry and no circuit breaker, so a destination that initialized and keeps failing keeps
|
|
169
|
+
* receiving entries; one that needs to back off does so itself.
|
|
170
170
|
* (A destination whose `onInit()` failed is a different case: it receives no
|
|
171
171
|
* entries at all.)
|
|
172
172
|
*
|
|
@@ -235,8 +235,8 @@ interface ILogDestination {
|
|
|
235
235
|
* Optional lifecycle hook — called during NestJS `onApplicationShutdown`.
|
|
236
236
|
* MUST flush any pending writes and close resources.
|
|
237
237
|
*
|
|
238
|
-
* The library awaits this
|
|
239
|
-
*
|
|
238
|
+
* The library awaits this within the shutdown budget (`shutdown.timeoutMs`): a hook that has
|
|
239
|
+
* not settled when the budget ends is reported and left, and the hooks not yet called are skipped.
|
|
240
240
|
*/
|
|
241
241
|
onShutdown?(): void | PromiseLike<void>;
|
|
242
242
|
}
|
|
@@ -1249,9 +1249,9 @@ declare class DefaultStdoutDestination implements ILogDestination {
|
|
|
1249
1249
|
readonly name = "stdout-json";
|
|
1250
1250
|
readonly minLevel?: LogLevel;
|
|
1251
1251
|
/**
|
|
1252
|
-
* @param opts.minLevel — Optional minimum level
|
|
1253
|
-
*
|
|
1254
|
-
*
|
|
1252
|
+
* @param opts.minLevel — Optional minimum level for this destination. Entries
|
|
1253
|
+
* below it, or below the module `level`, never reach `write`. Omit (or pass
|
|
1254
|
+
* `undefined`) to receive what the module `level` lets through.
|
|
1255
1255
|
*/
|
|
1256
1256
|
constructor(opts?: {
|
|
1257
1257
|
minLevel?: LogLevel;
|
package/dist/server/index.d.ts
CHANGED
|
@@ -163,10 +163,10 @@ interface ILogDestination {
|
|
|
163
163
|
* - Return a Promise for async I/O
|
|
164
164
|
*
|
|
165
165
|
* Errors thrown here, and rejections of a returned promise, are caught by the
|
|
166
|
-
* library: the entry is dropped for this destination only
|
|
167
|
-
*
|
|
168
|
-
* breaker, so a destination that initialized and keeps failing keeps
|
|
169
|
-
* entries
|
|
166
|
+
* library: the entry is dropped for this destination only. Failure lines on stderr
|
|
167
|
+
* are throttled to one a window for each destination, and shutdown writes the total when more than one write failed. There is no
|
|
168
|
+
* retry and no circuit breaker, so a destination that initialized and keeps failing keeps
|
|
169
|
+
* receiving entries; one that needs to back off does so itself.
|
|
170
170
|
* (A destination whose `onInit()` failed is a different case: it receives no
|
|
171
171
|
* entries at all.)
|
|
172
172
|
*
|
|
@@ -235,8 +235,8 @@ interface ILogDestination {
|
|
|
235
235
|
* Optional lifecycle hook — called during NestJS `onApplicationShutdown`.
|
|
236
236
|
* MUST flush any pending writes and close resources.
|
|
237
237
|
*
|
|
238
|
-
* The library awaits this
|
|
239
|
-
*
|
|
238
|
+
* The library awaits this within the shutdown budget (`shutdown.timeoutMs`): a hook that has
|
|
239
|
+
* not settled when the budget ends is reported and left, and the hooks not yet called are skipped.
|
|
240
240
|
*/
|
|
241
241
|
onShutdown?(): void | PromiseLike<void>;
|
|
242
242
|
}
|
|
@@ -1249,9 +1249,9 @@ declare class DefaultStdoutDestination implements ILogDestination {
|
|
|
1249
1249
|
readonly name = "stdout-json";
|
|
1250
1250
|
readonly minLevel?: LogLevel;
|
|
1251
1251
|
/**
|
|
1252
|
-
* @param opts.minLevel — Optional minimum level
|
|
1253
|
-
*
|
|
1254
|
-
*
|
|
1252
|
+
* @param opts.minLevel — Optional minimum level for this destination. Entries
|
|
1253
|
+
* below it, or below the module `level`, never reach `write`. Omit (or pass
|
|
1254
|
+
* `undefined`) to receive what the module `level` lets through.
|
|
1255
1255
|
*/
|
|
1256
1256
|
constructor(opts?: {
|
|
1257
1257
|
minLevel?: LogLevel;
|
package/dist/server/index.mjs
CHANGED
|
@@ -1937,9 +1937,9 @@ function writeStderrSafely(line) {
|
|
|
1937
1937
|
// src/server/destinations/default-stdout.destination.ts
|
|
1938
1938
|
var DefaultStdoutDestination = class {
|
|
1939
1939
|
/**
|
|
1940
|
-
* @param opts.minLevel — Optional minimum level
|
|
1941
|
-
*
|
|
1942
|
-
*
|
|
1940
|
+
* @param opts.minLevel — Optional minimum level for this destination. Entries
|
|
1941
|
+
* below it, or below the module `level`, never reach `write`. Omit (or pass
|
|
1942
|
+
* `undefined`) to receive what the module `level` lets through.
|
|
1943
1943
|
*/
|
|
1944
1944
|
constructor(opts = {}) {
|
|
1945
1945
|
this.name = "stdout-json";
|
package/package.json
CHANGED