@bymax-one/nest-logger 1.4.32 → 1.4.34
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 +24 -2
- package/README.md +8 -8
- package/dist/server/index.cjs +3 -3
- package/dist/server/index.d.cts +21 -19
- package/dist/server/index.d.ts +21 -19
- package/dist/server/index.mjs +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -12,12 +12,32 @@ heading here.
|
|
|
12
12
|
|
|
13
13
|
## [Unreleased]
|
|
14
14
|
|
|
15
|
+
## [1.4.34] - 2026-11-27
|
|
16
|
+
|
|
17
|
+
No behaviour change: the published JavaScript is byte-identical to `1.4.33`, and the type declarations differ in comments only.
|
|
18
|
+
|
|
19
|
+
### Documentation
|
|
20
|
+
|
|
21
|
+
- **The redaction warning shows a call that writes the entry.** Its example used `log()`, which takes Nest's arguments and drops the message, the user id and the metadata of that call; it now uses `info()`.
|
|
22
|
+
- **The redaction engine is named `@pinojs/redact`**, which is what Pino depends on from `10.1.0`, in the README and the doc comments. Two comments that gave a behaviour of the engine it does not have are removed: that duplicate paths throw, and that wildcards stop at bracket-syntax keys.
|
|
23
|
+
- **The README paragraph on how field names are compared reads as one rule again**: it carried the clause about letters that are not ASCII twice, spliced together.
|
|
24
|
+
- **`maxStringLength` and `shutdown` no longer claim more than they do**, in the README and the type declarations: not every string of a record is cut, the text of an object written as the fields of an entry is, and a destination that failed to initialize gets no `onShutdown`.
|
|
25
|
+
|
|
26
|
+
## [1.4.33] - 2026-11-27
|
|
27
|
+
|
|
28
|
+
No behaviour change: the published code differs from `1.4.32` in one comment.
|
|
29
|
+
|
|
30
|
+
### Documentation
|
|
31
|
+
|
|
32
|
+
- **`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.
|
|
33
|
+
- **The `1.4.32` entry on the README says what it filled**: gaps against the behaviour as well as against the types.
|
|
34
|
+
|
|
15
35
|
## [1.4.32] - 2026-11-26
|
|
16
36
|
|
|
17
37
|
### Documentation
|
|
18
38
|
|
|
19
39
|
- **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.
|
|
20
|
-
- **The README fills gaps it had against the published types**, in the options, the HTTP fields, the decorators, the helpers and the destinations.
|
|
40
|
+
- **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.
|
|
21
41
|
- **The row for `censorMessageText` is removed.** The method is marked `@internal`.
|
|
22
42
|
- **The comments on `ILogDestination` match the registry**, on write failure reports and on the shutdown budget.
|
|
23
43
|
|
|
@@ -3586,7 +3606,9 @@ published `dist/` is identical — no runtime behaviour changes for consumers.
|
|
|
3586
3606
|
- Professional CI suite: `ci.yml`, `bench.yml`, `codeql.yml`, `scorecard.yml`,
|
|
3587
3607
|
`release.yml`, Dependabot, and issue templates
|
|
3588
3608
|
|
|
3589
|
-
[Unreleased]: https://github.com/bymaxone/nest-logger/compare/v1.4.
|
|
3609
|
+
[Unreleased]: https://github.com/bymaxone/nest-logger/compare/v1.4.34...HEAD
|
|
3610
|
+
[1.4.34]: https://github.com/bymaxone/nest-logger/compare/v1.4.33...v1.4.34
|
|
3611
|
+
[1.4.33]: https://github.com/bymaxone/nest-logger/compare/v1.4.32...v1.4.33
|
|
3590
3612
|
[1.4.32]: https://github.com/bymaxone/nest-logger/compare/v1.4.31...v1.4.32
|
|
3591
3613
|
[1.4.31]: https://github.com/bymaxone/nest-logger/compare/v1.4.30...v1.4.31
|
|
3592
3614
|
[1.4.30]: https://github.com/bymaxone/nest-logger/compare/v1.4.29...v1.4.30
|
package/README.md
CHANGED
|
@@ -271,12 +271,12 @@ 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
|
|
275
|
-
| `redactStrategy` | `'names' \| 'paths'` | `'names'` | Engine behind the DEFAULT set. `'paths'` is the legacy
|
|
274
|
+
| `redactPaths` | `string[]` | `[]` | Additional `@pinojs/redact` paths (each at most 256 characters), applied on top of the default coverage |
|
|
275
|
+
| `redactStrategy` | `'names' \| 'paths'` | `'names'` | Engine behind the DEFAULT set. `'paths'` is the legacy `@pinojs/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 |
|
|
278
278
|
| `maxEntrySizeBytes` | `number` | `65536` | UTF-8 byte ceiling per serialized field, a whole number from 1 to 2147483647 (`err` + any custom serializer); over it the value becomes a truncation envelope |
|
|
279
|
-
| `maxStringLength` | `number` | unset (a string is written whole) |
|
|
279
|
+
| `maxStringLength` | `number` | unset (a string is written whole) | A cut for long string values, an integer from 64 to 2147483647; a value it cuts ends with `…[truncated]`. Not every string is cut (`err` is not): see [Bounded string length](#bounded-string-length) |
|
|
280
280
|
| `destinationHookTimeoutMs` | `number` | `10000` | Longest `onInit` or `onRegistryReady` of a destination, in ms (an integer from 1 to 2147483647). An `onInit` that does not settle in time counts as one that threw: the destination is failed, skipped and reported, and stays inactive if the call settles later. A hung `onInit` may leak what it opened |
|
|
281
281
|
| `errorOwnFields` | `'all' \| 'safe'` | `'all'` | Which own fields of an error are written. `'all'` writes every one; `'safe'` writes an allow-list of operational names plus `errorOwnFieldNames` (see [Error fields](#error-fields)). A binary value is written as its size in both. Recommended: `'safe'` |
|
|
282
282
|
| `errorOwnFieldNames` | `readonly string[]` | `[]` | Own-field names `'safe'` writes beside its default list, matched exactly; ignored under `'all'` |
|
|
@@ -302,7 +302,7 @@ A key that holds `undefined` or `null` is read as not set, in the options and in
|
|
|
302
302
|
|
|
303
303
|
- Every option is type-checked at startup: a wrong type (the string `'false'` for a boolean, say) throws `[BymaxLoggerModule] options.<path> …` and names what was received by type, never by value.
|
|
304
304
|
- `service.name` and `service.version` must be strings that are not blank after `trim()`.
|
|
305
|
-
- `redactPaths` entries must be non-empty strings in
|
|
305
|
+
- `redactPaths` entries must be non-empty strings in `@pinojs/redact` path syntax. That is the engine Pino ships from `10.1.0`; `10.0.0` ships `slow-redact` in its place. A malformed path (`a..b`, `a[`) is not checked by the module: Pino refuses it while the logger is built, with an error that is not prefixed `[BymaxLoggerModule]`.
|
|
306
306
|
- Each `destinations` entry must be an object with a non-empty string `name` and a `write` function; `onInit`, `onShutdown` and `onRegistryReady`, when present, must be functions. Anything else is refused at startup with `[BymaxLoggerModule] options.destinations[i] …`.
|
|
307
307
|
- `serializers` must be a plain object whose every value is a function; a key `err` replaces the default `err` serializer.
|
|
308
308
|
- `http.excludePaths` replaces the default list instead of adding to it, and the defaults are exact anchored paths: `[/^\/health$/]` stops excluding `/metrics`.
|
|
@@ -323,7 +323,7 @@ A key that holds `undefined` or `null` is read as not set, in the options and in
|
|
|
323
323
|
|
|
324
324
|
### `shutdown` options
|
|
325
325
|
|
|
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
|
|
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, in reverse registration order, the `onShutdown` of each destination that did not fail to initialize. 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
328
|
| Option | Type | Default | Description |
|
|
329
329
|
| ------------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -881,13 +881,13 @@ The library censors **62 sensitive field names** wherever they appear in a recor
|
|
|
881
881
|
| Other spellings | `access_token`, `refresh_token`, `id_token`, `api_key`, `apikey`, `api_secret`, `client_secret`, `signing_secret`, `private_key`, `secret_key`, `secretKey`, `access-token`, `refresh-token`, `id-token`, `api-key`, `client-secret`, `private-key`, `proxy-authorization`, `session_token`, `sessionToken`, `sessiontoken`, `session-token`, `x-csrf-token`, `x-xsrf-token`, `csrf_token`, `csrfToken`, `csrf-token`, `password_hash`, `new_password`, `old_password` |
|
|
882
882
|
| HTTP headers (absolute) | `req.headers.authorization`, `req.headers.cookie`, `req.headers["x-api-key"]`, `req.headers["x-auth-token"]`, `res.headers["set-cookie"]` — retained for the legacy `'paths'` strategy; the by-name row above already covers these shapes and every other |
|
|
883
883
|
|
|
884
|
-
Redaction is one **recursive, snapshotting walk**: a value is censored when its key name is in the set, wherever it sits. A name and a key are compared in one folded form: the case, every character that is not a letter or a digit (the separators `_`, `.` and `-` and every other dash, mark and punctuation), white space, control and zero-width characters, combining marks, the compatibility forms Unicode defines, the negative circled and squared letters and the regional indicators (read as their Latin letter), a symbol that is not ASCII and is no letter (read as a character that stands for nothing, one or two characters of a name) and a list of letters drawn like a Latin one are read through, and
|
|
884
|
+
Redaction is one **recursive, snapshotting walk**: a value is censored when its key name is in the set, wherever it sits. A name and a key are compared in one folded form: the case, every character that is not a letter or a digit (the separators `_`, `.` and `-` and every other dash, mark and punctuation), white space, control and zero-width characters, combining marks, the compatibility forms Unicode defines, the negative circled and squared letters and the regional indicators (read as their Latin letter), a symbol that is not ASCII and is no letter or currency sign (read as a character that stands for nothing, one or two characters of a name) and a list of letters drawn like a Latin one are read through, so `apiKey` also hides `api_key`, `API-KEY`, `api\u200bKey` and `\u0430piKey`. A letter that is not ASCII and that the list does not read as one Latin letter can stand for one or two characters of a name, so a key that has one may be hidden although it does not spell that name (`autһorization` is hidden by `authorization`). The keys the entry owns are compared exactly after folding, so a caller field is never dropped for a letter the folding does not read. A key that spells a configured name another way is the same name, so a field whose name only differs in those ways is hidden too. A `redactPaths` entry is at most 256 characters (a longer one is refused at startup by option name, without its value). Under `redactStrategy: 'paths'` the paths are matched exactly by `@pinojs/redact`: literally, with no folding of case, separators or look-alikes. Nothing the caller passed is mutated, and every value is read once and pinned into a fresh structure, so what reaches the sink is what was inspected even when the payload carries accessors or a `toJSON` that could answer differently on a second read. A value with a `toJSON` is inspected through that method's output; when the source object itself carries a sensitive key, the method is not trusted and the whole value is censored, because a method could rename what it exposes. `DEFAULT_REDACT_PATHS` is still exported at full fidelity, and `redactStrategy: 'paths'` feeds it to `@pinojs/redact` for anyone depending on exact path semantics, with a four-level ceiling and a much higher cost.
|
|
885
885
|
|
|
886
886
|
> [!NOTE]
|
|
887
887
|
> A bare `sessionId`, `session_id` or `session-id` is **not** on the list: many applications carry one as a correlation key, and a name cannot be switched off one at a time. A session id that is itself a bearer credential in your system must be added to your own `redactPaths` (`redactPaths: ['sessionId']` censors it at any depth under the default strategy).
|
|
888
888
|
|
|
889
889
|
> [!WARNING]
|
|
890
|
-
> Redaction matches **key names**. A secret under a name you have not declared sensitive is emitted: `logger.
|
|
890
|
+
> Redaction matches **key names**. A secret under a name you have not declared sensitive is emitted: `logger.info(key, msg, userId, { renamed: user.password })` writes it in clear, and so does a `toJSON` that renames nested state. No name matcher can follow a value through a rename. Declare the name, or keep the value out of the log.
|
|
891
891
|
|
|
892
892
|
**One entry, one line.** Every message argument passes through a normalization before it reaches Pino: line separators (`\r`, `\n`, U+2028, U+2029, U+0085) become the two-character sequence `\n`, and every other control character that can drive a terminal (ESC, vertical tab, form feed, backspace, the rest of C0 except TAB, DEL and the C1 range) becomes a readable `\uXXXX` escape. This keeps a message from forging an entry in `pino-pretty` and in any destination that re-renders it, and `JSON.stringify` alone would leave DEL, C1, U+2028 and U+2029 verbatim in a raw line read in a terminal. The scrubbed stack gets the same escaping (its newlines are kept). Structured fields are untouched, so `err.message` keeps the original text, and a control character in a **metadata value** still reaches a terminal: only `msg` and the stack carry this guarantee.
|
|
893
893
|
|
|
@@ -982,7 +982,7 @@ Every serializer, the default `err` one and any you supply, is wrapped so a fiel
|
|
|
982
982
|
|
|
983
983
|
`maxEntrySizeBytes` bounds what a serializer returns and the derived exception fields, and a string under a metadata key is the caller's own data, written as given. `maxStringLength` bounds that string too, and is off until set. A string longer than the limit is cut to that many characters (UTF-16 units, so a cut never splits a surrogate pair) and ends with `…[truncated]`; what is written is the limit plus 12 characters at most, and a string of exactly the limit is written whole.
|
|
984
984
|
|
|
985
|
-
It applies to every string value of the record at any depth, in an object or an array, after redaction: a value a redaction rule censors is the censor and not a cut text. It does not apply to a key, to a value that is not text, to the log message (
|
|
985
|
+
It applies to every string value of the record at any depth, in an object or an array, after redaction: a value a redaction rule censors is the censor and not a cut text. It does not apply to a key, to a value that is not text, to the log message (capped at 16384 characters; the one exception is the text of an object that is written as the fields of the entry, which is cut), to the `logKey` of the entry (an identifier, and `event.name` is derived from it), to the bindings of a logger (the service identity and the `context` of an `@InjectLogger` logger are written once, whole), to anything under a key that has a serializer (`err` and the keys of `serializers`): this limit does not cut the error you log under `err`, and `maxEntrySizeBytes` caps what a serializer returns when that output serializes to JSON. The event name and the `exception.type`, `exception.message`, `exception.stacktrace` and `error.type` fields written from an error are added after the cut, so the limit does not apply to them, and the exception fields among them are cut by `maxEntrySizeBytes` (in UTF-8 bytes) and by the cap of 16384 characters, and a key of your own with one of those names is cut like any other string. The names left whole are matched on the root key, so a key of your own named like a key of `serializers` is left whole too. An `Error` placed in the metadata under any other key is data of the record when the cut runs, so its message, its stack and its own fields are cut like any other string. The limit is an integer from 64, because the strings the library writes into a record itself (trace and span ids) are shorter than that. A string the caller supplies, such as a `userId`, a `tenantId`, or a `requestId` taken from an inbound request header, is cut like any other when it is longer than the limit. Setting it makes the record walk run even when no field name is covered (`shouldDisableDefaultRedact: true` and no `redactPaths`), and the walk writes a boxed `String` or `Number`, a `Buffer`, a `Uint8Array` and an `Error` in the metadata as the default redaction already does: a two-byte `Buffer` is written as `[Binary 2 bytes]` and not as `{"type":"Buffer","data":[104,105]}`, while a boxed `Number` is written as `{}` and a boxed `String` as a map of its indexes (`{"0":"a","1":"b","2":"c"}` for `new String('abc')`), as the default redaction writes them. A `redactCensor` longer than the limit is refused at startup, because a censor the cut shortened would no longer be the text you look for in place of a secret.
|
|
986
986
|
|
|
987
987
|
### Security Checklist
|
|
988
988
|
|
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
|
@@ -470,10 +470,10 @@ interface DestinationQueueOptions {
|
|
|
470
470
|
/**
|
|
471
471
|
* The time application shutdown has to flush the destinations.
|
|
472
472
|
*
|
|
473
|
-
* Shutdown first drains the queue each destination holds, then calls
|
|
474
|
-
* `onShutdown`
|
|
475
|
-
* the number of destinations: a destination reached after the
|
|
476
|
-
* and its `onShutdown` is not called.
|
|
473
|
+
* Shutdown first drains the queue each destination holds, then calls, in reverse registration
|
|
474
|
+
* order, the `onShutdown` of each destination that did not fail to initialize. The whole sequence is
|
|
475
|
+
* bounded by `timeoutMs`, whatever the number of destinations: a destination reached after the
|
|
476
|
+
* budget is spent is reported as skipped and its `onShutdown` is not called.
|
|
477
477
|
*/
|
|
478
478
|
interface ShutdownOptions {
|
|
479
479
|
/**
|
|
@@ -532,18 +532,19 @@ interface BymaxLoggerModuleOptions {
|
|
|
532
532
|
*/
|
|
533
533
|
shouldUseAsNestLogger?: boolean;
|
|
534
534
|
/**
|
|
535
|
-
* Additional
|
|
536
|
-
* whatever `redactStrategy` is in force.
|
|
535
|
+
* Additional `@pinojs/redact` paths, applied on top of the default coverage
|
|
536
|
+
* whatever `redactStrategy` is in force. Pino ships `@pinojs/redact` from
|
|
537
|
+
* `10.1.0`; `10.0.0` ships `slow-redact` in its place.
|
|
537
538
|
*/
|
|
538
539
|
redactPaths?: readonly string[];
|
|
539
540
|
/**
|
|
540
541
|
* Engine backing the DEFAULT redaction set (never the consumer's own
|
|
541
|
-
* `redactPaths`, which are always
|
|
542
|
+
* `redactPaths`, which are always `@pinojs/redact` paths).
|
|
542
543
|
*
|
|
543
544
|
* - `'names'` (default) — one recursive walk censoring any value whose KEY
|
|
544
545
|
* NAME is in `REDACT_COMMON_FIELDS`, at ANY depth. ~943 k logs/s.
|
|
545
546
|
* - `'paths'` — the pre-1.2 engine: `DEFAULT_REDACT_PATHS` handed to
|
|
546
|
-
*
|
|
547
|
+
* `@pinojs/redact`. Matches only wildcard depths 1–4 and measures ~9.3 k
|
|
547
548
|
* logs/s. Provided as an escape hatch for a consumer depending on exact
|
|
548
549
|
* path-matching semantics; expect it to be removed in a future major.
|
|
549
550
|
*/
|
|
@@ -625,14 +626,15 @@ interface BymaxLoggerModuleOptions {
|
|
|
625
626
|
*/
|
|
626
627
|
maxEntrySizeBytes?: number;
|
|
627
628
|
/**
|
|
628
|
-
* The most characters a string of a log record is written with
|
|
629
|
-
* many characters, without splitting a surrogate pair, and ends
|
|
630
|
-
* written is up to 12 characters longer than the limit. An integer
|
|
631
|
-
* Default: not set, and a string is written whole.
|
|
629
|
+
* The most characters a string value of a log record is written with, with the exceptions below.
|
|
630
|
+
* A longer string is cut to this many characters, without splitting a surrogate pair, and ends
|
|
631
|
+
* with `…[truncated]`, so what is written is up to 12 characters longer than the limit. An integer
|
|
632
|
+
* from 64 to 2147483647. Default: not set, and a string is written whole.
|
|
632
633
|
*
|
|
633
634
|
* Applies to every string value of the record at any depth, but not to a key, a value that is
|
|
634
|
-
* not text, the log message (
|
|
635
|
-
*
|
|
635
|
+
* not text, the log message (capped at 16384 characters; the one exception is the text of an
|
|
636
|
+
* object that is written as the fields of the entry, which is cut), the `logKey`, the bindings of
|
|
637
|
+
* a logger (the service identity and a `context`), a value a redaction rule censors, or anything
|
|
636
638
|
* under a key that has a serializer (`err` and the keys of `serializers`; see
|
|
637
639
|
* `maxEntrySizeBytes`), so the stack of an error logged under `err` is never cut by it. The event
|
|
638
640
|
* name and the `exception.*` and `error.type` fields the library writes are added after the cut,
|
|
@@ -1249,9 +1251,9 @@ declare class DefaultStdoutDestination implements ILogDestination {
|
|
|
1249
1251
|
readonly name = "stdout-json";
|
|
1250
1252
|
readonly minLevel?: LogLevel;
|
|
1251
1253
|
/**
|
|
1252
|
-
* @param opts.minLevel — Optional minimum level
|
|
1253
|
-
*
|
|
1254
|
-
*
|
|
1254
|
+
* @param opts.minLevel — Optional minimum level for this destination. Entries
|
|
1255
|
+
* below it, or below the module `level`, never reach `write`. Omit (or pass
|
|
1256
|
+
* `undefined`) to receive what the module `level` lets through.
|
|
1255
1257
|
*/
|
|
1256
1258
|
constructor(opts?: {
|
|
1257
1259
|
minLevel?: LogLevel;
|
|
@@ -2140,7 +2142,7 @@ declare const LOG_CONTEXT_TOKEN: unique symbol;
|
|
|
2140
2142
|
*/
|
|
2141
2143
|
declare const REDACT_COMMON_FIELDS: readonly string[];
|
|
2142
2144
|
/**
|
|
2143
|
-
* The legacy
|
|
2145
|
+
* The legacy `@pinojs/redact` path expansion of {@link REDACT_COMMON_FIELDS}:
|
|
2144
2146
|
* every name at the record root plus wildcard depths 1–4, followed by the
|
|
2145
2147
|
* absolute header paths. Length is derived, not fixed — `fields × 5 + absolute`.
|
|
2146
2148
|
*
|
|
@@ -2150,7 +2152,7 @@ declare const REDACT_COMMON_FIELDS: readonly string[];
|
|
|
2150
2152
|
* The bare field names come first, at depth 0 — the log record's own root.
|
|
2151
2153
|
* `emitStructured` spreads caller metadata there (`{ ...metadata, logKey, ... }`),
|
|
2152
2154
|
* so a field named `password` passed as metadata lands at the root, which the
|
|
2153
|
-
* depth-1-and-deeper wildcards below never reach (
|
|
2155
|
+
* depth-1-and-deeper wildcards below never reach (`@pinojs/redact`'s `*` matches a
|
|
2154
2156
|
* level, not the root). Without the bare name the library's own documented call
|
|
2155
2157
|
* `logger.info(key, msg, userId, { password })` would write the password in clear.
|
|
2156
2158
|
* Listing it makes the default set cover a sensitive field wherever it appears.
|
package/dist/server/index.d.ts
CHANGED
|
@@ -470,10 +470,10 @@ interface DestinationQueueOptions {
|
|
|
470
470
|
/**
|
|
471
471
|
* The time application shutdown has to flush the destinations.
|
|
472
472
|
*
|
|
473
|
-
* Shutdown first drains the queue each destination holds, then calls
|
|
474
|
-
* `onShutdown`
|
|
475
|
-
* the number of destinations: a destination reached after the
|
|
476
|
-
* and its `onShutdown` is not called.
|
|
473
|
+
* Shutdown first drains the queue each destination holds, then calls, in reverse registration
|
|
474
|
+
* order, the `onShutdown` of each destination that did not fail to initialize. The whole sequence is
|
|
475
|
+
* bounded by `timeoutMs`, whatever the number of destinations: a destination reached after the
|
|
476
|
+
* budget is spent is reported as skipped and its `onShutdown` is not called.
|
|
477
477
|
*/
|
|
478
478
|
interface ShutdownOptions {
|
|
479
479
|
/**
|
|
@@ -532,18 +532,19 @@ interface BymaxLoggerModuleOptions {
|
|
|
532
532
|
*/
|
|
533
533
|
shouldUseAsNestLogger?: boolean;
|
|
534
534
|
/**
|
|
535
|
-
* Additional
|
|
536
|
-
* whatever `redactStrategy` is in force.
|
|
535
|
+
* Additional `@pinojs/redact` paths, applied on top of the default coverage
|
|
536
|
+
* whatever `redactStrategy` is in force. Pino ships `@pinojs/redact` from
|
|
537
|
+
* `10.1.0`; `10.0.0` ships `slow-redact` in its place.
|
|
537
538
|
*/
|
|
538
539
|
redactPaths?: readonly string[];
|
|
539
540
|
/**
|
|
540
541
|
* Engine backing the DEFAULT redaction set (never the consumer's own
|
|
541
|
-
* `redactPaths`, which are always
|
|
542
|
+
* `redactPaths`, which are always `@pinojs/redact` paths).
|
|
542
543
|
*
|
|
543
544
|
* - `'names'` (default) — one recursive walk censoring any value whose KEY
|
|
544
545
|
* NAME is in `REDACT_COMMON_FIELDS`, at ANY depth. ~943 k logs/s.
|
|
545
546
|
* - `'paths'` — the pre-1.2 engine: `DEFAULT_REDACT_PATHS` handed to
|
|
546
|
-
*
|
|
547
|
+
* `@pinojs/redact`. Matches only wildcard depths 1–4 and measures ~9.3 k
|
|
547
548
|
* logs/s. Provided as an escape hatch for a consumer depending on exact
|
|
548
549
|
* path-matching semantics; expect it to be removed in a future major.
|
|
549
550
|
*/
|
|
@@ -625,14 +626,15 @@ interface BymaxLoggerModuleOptions {
|
|
|
625
626
|
*/
|
|
626
627
|
maxEntrySizeBytes?: number;
|
|
627
628
|
/**
|
|
628
|
-
* The most characters a string of a log record is written with
|
|
629
|
-
* many characters, without splitting a surrogate pair, and ends
|
|
630
|
-
* written is up to 12 characters longer than the limit. An integer
|
|
631
|
-
* Default: not set, and a string is written whole.
|
|
629
|
+
* The most characters a string value of a log record is written with, with the exceptions below.
|
|
630
|
+
* A longer string is cut to this many characters, without splitting a surrogate pair, and ends
|
|
631
|
+
* with `…[truncated]`, so what is written is up to 12 characters longer than the limit. An integer
|
|
632
|
+
* from 64 to 2147483647. Default: not set, and a string is written whole.
|
|
632
633
|
*
|
|
633
634
|
* Applies to every string value of the record at any depth, but not to a key, a value that is
|
|
634
|
-
* not text, the log message (
|
|
635
|
-
*
|
|
635
|
+
* not text, the log message (capped at 16384 characters; the one exception is the text of an
|
|
636
|
+
* object that is written as the fields of the entry, which is cut), the `logKey`, the bindings of
|
|
637
|
+
* a logger (the service identity and a `context`), a value a redaction rule censors, or anything
|
|
636
638
|
* under a key that has a serializer (`err` and the keys of `serializers`; see
|
|
637
639
|
* `maxEntrySizeBytes`), so the stack of an error logged under `err` is never cut by it. The event
|
|
638
640
|
* name and the `exception.*` and `error.type` fields the library writes are added after the cut,
|
|
@@ -1249,9 +1251,9 @@ declare class DefaultStdoutDestination implements ILogDestination {
|
|
|
1249
1251
|
readonly name = "stdout-json";
|
|
1250
1252
|
readonly minLevel?: LogLevel;
|
|
1251
1253
|
/**
|
|
1252
|
-
* @param opts.minLevel — Optional minimum level
|
|
1253
|
-
*
|
|
1254
|
-
*
|
|
1254
|
+
* @param opts.minLevel — Optional minimum level for this destination. Entries
|
|
1255
|
+
* below it, or below the module `level`, never reach `write`. Omit (or pass
|
|
1256
|
+
* `undefined`) to receive what the module `level` lets through.
|
|
1255
1257
|
*/
|
|
1256
1258
|
constructor(opts?: {
|
|
1257
1259
|
minLevel?: LogLevel;
|
|
@@ -2140,7 +2142,7 @@ declare const LOG_CONTEXT_TOKEN: unique symbol;
|
|
|
2140
2142
|
*/
|
|
2141
2143
|
declare const REDACT_COMMON_FIELDS: readonly string[];
|
|
2142
2144
|
/**
|
|
2143
|
-
* The legacy
|
|
2145
|
+
* The legacy `@pinojs/redact` path expansion of {@link REDACT_COMMON_FIELDS}:
|
|
2144
2146
|
* every name at the record root plus wildcard depths 1–4, followed by the
|
|
2145
2147
|
* absolute header paths. Length is derived, not fixed — `fields × 5 + absolute`.
|
|
2146
2148
|
*
|
|
@@ -2150,7 +2152,7 @@ declare const REDACT_COMMON_FIELDS: readonly string[];
|
|
|
2150
2152
|
* The bare field names come first, at depth 0 — the log record's own root.
|
|
2151
2153
|
* `emitStructured` spreads caller metadata there (`{ ...metadata, logKey, ... }`),
|
|
2152
2154
|
* so a field named `password` passed as metadata lands at the root, which the
|
|
2153
|
-
* depth-1-and-deeper wildcards below never reach (
|
|
2155
|
+
* depth-1-and-deeper wildcards below never reach (`@pinojs/redact`'s `*` matches a
|
|
2154
2156
|
* level, not the root). Without the bare name the library's own documented call
|
|
2155
2157
|
* `logger.info(key, msg, userId, { password })` would write the password in clear.
|
|
2156
2158
|
* Listing it makes the default set cover a sensitive field wherever it appears.
|
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