@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.
- package/CHANGELOG.md +33 -1
- package/README.md +11 -0
- package/dist/server/index.cjs +502 -461
- package/dist/server/index.d.cts +18 -0
- package/dist/server/index.d.ts +18 -0
- package/dist/server/index.mjs +502 -461
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,37 @@ heading here.
|
|
|
11
11
|
|
|
12
12
|
## [Unreleased]
|
|
13
13
|
|
|
14
|
+
## [1.4.12] - 2026-11-08
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- **`BymaxLoggerModule.useRequestContext(app)`.** Opens the request-id correlation scope ahead of
|
|
19
|
+
the body parser, from `main.ts`, like `useNestLogger(app)`. A request the parser refuses
|
|
20
|
+
(truncated JSON, an unsupported content encoding, a body over the limit) now has its `requestId`
|
|
21
|
+
and the `x-request-id` response header, so a consumer's exception filter that reads the id from
|
|
22
|
+
`LogContextService` writes the same value in its envelope. It mounts only the scope and can be
|
|
23
|
+
combined with `applyAccessLog(app)` or `applyRequestIdMiddleware(consumer)`. Additive: nothing
|
|
24
|
+
changes for an application that does not call it.
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- **1.4.11 behaviour its notes did not list.** Under `errorOwnFields: 'all'` with
|
|
29
|
+
`redactStrategy: 'paths'`, an `Error` whose `toJSON` is a hostile accessor has been written as
|
|
30
|
+
`UnknownError` since 1.4.11, as `redactStrategy: 'names'` already did; 1.4.10 wrote it as an
|
|
31
|
+
`Error`. Nothing changes here; this records it.
|
|
32
|
+
|
|
33
|
+
#### Apply to a derived backend
|
|
34
|
+
|
|
35
|
+
Nothing is required: `BymaxLoggerModule.useRequestContext(app)` is a new static method and an
|
|
36
|
+
application that does not call it behaves as before. To have a request the body parser refuses
|
|
37
|
+
(truncated JSON, an unsupported content encoding, a body over the limit) carry its `requestId` and
|
|
38
|
+
the `x-request-id` response header, call it in `main.ts` right after `NestFactory.create()` and
|
|
39
|
+
before `app.init()` / `app.listen()`. Register the filter that writes the id into your envelope with `app.useGlobalFilters(...)` after
|
|
40
|
+
`NestFactory.create()`: with `http.isEnabled` (and `http.shouldCaptureExceptions`, which defaults to `true`) the library registers its own exception filter as an
|
|
41
|
+
`APP_FILTER` provider, and an `APP_FILTER` provider of yours was answered by it in the measurement,
|
|
42
|
+
with or without an injected dependency, while a filter registered with `useGlobalFilters` answered
|
|
43
|
+
instead.
|
|
44
|
+
|
|
14
45
|
## [1.4.11] - 2026-11-08
|
|
15
46
|
|
|
16
47
|
### Added
|
|
@@ -2516,7 +2547,8 @@ published `dist/` is identical — no runtime behaviour changes for consumers.
|
|
|
2516
2547
|
- Professional CI suite: `ci.yml`, `bench.yml`, `codeql.yml`, `scorecard.yml`,
|
|
2517
2548
|
`release.yml`, Dependabot, and issue templates
|
|
2518
2549
|
|
|
2519
|
-
[Unreleased]: https://github.com/bymaxone/nest-logger/compare/v1.4.
|
|
2550
|
+
[Unreleased]: https://github.com/bymaxone/nest-logger/compare/v1.4.12...HEAD
|
|
2551
|
+
[1.4.12]: https://github.com/bymaxone/nest-logger/compare/v1.4.11...v1.4.12
|
|
2520
2552
|
[1.4.11]: https://github.com/bymaxone/nest-logger/compare/v1.4.10...v1.4.11
|
|
2521
2553
|
[1.4.10]: https://github.com/bymaxone/nest-logger/compare/v1.4.9...v1.4.10
|
|
2522
2554
|
[1.4.9]: https://github.com/bymaxone/nest-logger/compare/v1.4.8...v1.4.9
|
package/README.md
CHANGED
|
@@ -447,6 +447,16 @@ reading `statusCode` and `writableFinished`, so it never depends on a route matc
|
|
|
447
447
|
running or a filter catching anything. One line in, one line out, for the parser rejection, the
|
|
448
448
|
unmatched-route 404, the guard rejection and the aborted connection alike.
|
|
449
449
|
|
|
450
|
+
To open only the correlation scope ahead of the parser, without the access log, call
|
|
451
|
+
`BymaxLoggerModule.useRequestContext(app)` at the same point. A request the parser refuses (truncated JSON,
|
|
452
|
+
a content encoding it does not support, a body over the limit) then has its `requestId` and the
|
|
453
|
+
`x-request-id` response header, so an exception filter that reads the id from `LogContextService`
|
|
454
|
+
puts the same value in its envelope. Register that filter with `app.useGlobalFilters(...)` after `NestFactory.create()`: with
|
|
455
|
+
`http.isEnabled` (and `http.shouldCaptureExceptions`, which defaults to `true`) the library registers its own exception filter as an `APP_FILTER` provider, and an
|
|
456
|
+
`APP_FILTER` provider of yours was answered by it in the measurement, with or without an injected
|
|
457
|
+
dependency, while a filter registered with `useGlobalFilters` answered instead. It can be combined with `applyAccessLog(app)` or
|
|
458
|
+
`applyRequestIdMiddleware(consumer)`: a second mount reuses the scope.
|
|
459
|
+
|
|
450
460
|
`applyRequestIdMiddleware(consumer)` remains supported and unchanged; it is the right choice when
|
|
451
461
|
correlation should be scoped to a route subtree rather than the whole application. **Wiring both is
|
|
452
462
|
safe** — the correlation middleware adopts an id already in scope instead of minting a second one,
|
|
@@ -1610,6 +1620,7 @@ Two kinds of failure, and they surface differently. A **thrown `Error`** carries
|
|
|
1610
1620
|
| `[BymaxLoggerModule] options.` | `forRoot` / `forRootAsync`, at module setup | any option fails validation: a missing `service`, a `level` outside the set, a bad type | Fix the option the message names; it prints the path and what it received |
|
|
1611
1621
|
| `[BymaxLoggerModule] useNestLogger(app) called but` | `BymaxLoggerModule.useNestLogger` | the module was never imported into the application | Import `BymaxLoggerModule` before calling it |
|
|
1612
1622
|
| `[BymaxLoggerModule] applyAccessLog(app) called but` | `applyAccessLog` | the module was never imported into the application | Import `BymaxLoggerModule` before calling it |
|
|
1623
|
+
| `[BymaxLoggerModule] useRequestContext(app) called but` | `useRequestContext` | the module was never imported into the application | Import `BymaxLoggerModule` before calling it |
|
|
1613
1624
|
| `[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 |
|
|
1614
1625
|
| `[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 |
|
|
1615
1626
|
| `[PrettyDevDestination] refused in production` | `PrettyDevDestination.onInit` | `NODE_ENV` is exactly `production` | Use `DefaultStdoutDestination` in production |
|