@ddd-ts-kit/pino 0.114.1 → 0.116.0
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/README.fr.md +17 -13
- package/README.md +15 -11
- package/dist/correlation/correlation-mixin.d.ts +4 -2
- package/dist/correlation/correlation-mixin.d.ts.map +1 -1
- package/dist/correlation/correlation-mixin.js +6 -2
- package/dist/correlation/correlation-mixin.js.map +1 -1
- package/dist/create-pino-logger.d.ts +0 -2
- package/dist/create-pino-logger.d.ts.map +1 -1
- package/dist/create-pino-logger.js +5 -2
- package/dist/create-pino-logger.js.map +1 -1
- package/dist/fields/line-fields.d.ts +3 -3
- package/dist/fields/line-fields.d.ts.map +1 -1
- package/dist/fields/line-fields.js +4 -4
- package/dist/fields/line-fields.js.map +1 -1
- package/dist/pino-logger.d.ts +7 -0
- package/dist/pino-logger.d.ts.map +1 -1
- package/dist/pino-logger.js +5 -3
- package/dist/pino-logger.js.map +1 -1
- package/dist/redaction/credential-redaction.d.ts +4 -3
- package/dist/redaction/credential-redaction.d.ts.map +1 -1
- package/dist/redaction/credential-redaction.js +7 -9
- package/dist/redaction/credential-redaction.js.map +1 -1
- package/dist/redaction/without-credentials-at-top.d.ts +4 -3
- package/dist/redaction/without-credentials-at-top.d.ts.map +1 -1
- package/dist/redaction/without-credentials-at-top.js +5 -5
- package/dist/redaction/without-credentials-at-top.js.map +1 -1
- package/package.json +3 -3
package/README.fr.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[English](README.md) · **Français**
|
|
2
|
-
<!-- translation-of: README.md sha256:
|
|
2
|
+
<!-- translation-of: README.md sha256:cdf16b8048155c8c -->
|
|
3
3
|
|
|
4
4
|
# @ddd-ts-kit/pino
|
|
5
5
|
|
|
@@ -111,14 +111,19 @@ import { traceLogFields } from '@ddd-ts-kit/tracing';
|
|
|
111
111
|
|
|
112
112
|
declare const scope: ExecutionScope; // celle que crée la racine de composition
|
|
113
113
|
|
|
114
|
+
const redact = [...CREDENTIAL_KEYS, 'iban'];
|
|
115
|
+
|
|
114
116
|
const instance = pino({
|
|
115
|
-
mixin: correlationMixin(() => traceLogFields(scope)),
|
|
116
|
-
redact: credentialRedaction(
|
|
117
|
+
mixin: correlationMixin(() => traceLogFields(scope), redact),
|
|
118
|
+
redact: credentialRedaction(redact),
|
|
117
119
|
});
|
|
118
120
|
|
|
119
|
-
export const logger = new PinoLogger(instance);
|
|
121
|
+
export const logger = new PinoLogger(instance, { redact });
|
|
120
122
|
```
|
|
121
123
|
|
|
124
|
+
Les trois prennent la même liste : pino masque une clé du premier niveau d'une ligne telle que
|
|
125
|
+
la liste l'écrit, l'adaptateur et le *mixin* l'y masquent dans toute autre casse.
|
|
126
|
+
|
|
122
127
|
`createPinoLogger` écrit `level` par son nom et le message sous `message`, comme le
|
|
123
128
|
`StdoutLogger` du *package* des aspects et comme `@ddd-ts-kit/winston` : un même tableau de bord
|
|
124
129
|
lit les trois. Une instance à vous garde les clés que vous lui avez données (`msg` et un niveau
|
|
@@ -235,12 +240,11 @@ d'une ligne, d'un enfant et de `fields` de la même façon. La valeur de ces cl
|
|
|
235
240
|
`refreshToken`, `idToken`, `client_secret`, `clientSecret`, `client-secret`, `private_key`,
|
|
236
241
|
`privateKey`
|
|
237
242
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
requête HTTP entière.
|
|
243
|
+
`redact: ['iban', 'ssn']` complète la liste. Chaque nom, de la liste ou ajouté, est comparé
|
|
244
|
+
quelle que soit sa casse (`Authorization`, `X-Api-Key`, `IBAN`), au premier niveau d'une ligne
|
|
245
|
+
et un niveau en dessous, par `hiddenKeys` du noyau : `@ddd-ts-kit/winston` et `StdoutLogger`
|
|
246
|
+
interrogent la même fonction. Rien n'est cherché plus profond qu'un niveau, ni dans une liste :
|
|
247
|
+
journalisez la partie que vous visez, pas une requête HTTP entière.
|
|
244
248
|
|
|
245
249
|
**Une erreur passée en champ** (`logger.error('payment failed', { error })` : la `LogValue` du
|
|
246
250
|
port admet une `Error`) est écrite telle que la décrit `describeError` du noyau, de la même façon
|
|
@@ -309,9 +313,9 @@ après le vidage ne s'exécuterait jamais. `app.stop()` l'appelle, en dernier, a
|
|
|
309
313
|
d'erreurs : l'arrêt journalise lui aussi. Sans l'application du *package* di, appelez-le
|
|
310
314
|
vous-même à cet endroit.
|
|
311
315
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
316
|
+
Un vidage ne clôt rien, comme le dit le port : une ligne journalisée ensuite est écrite comme
|
|
317
|
+
les autres, et avec `asynchronous: true` elle attend dans le tampon le vidage suivant ou le
|
|
318
|
+
crochet de sortie de pino.
|
|
315
319
|
|
|
316
320
|
## Performances
|
|
317
321
|
|
package/README.md
CHANGED
|
@@ -106,14 +106,19 @@ import { traceLogFields } from '@ddd-ts-kit/tracing';
|
|
|
106
106
|
|
|
107
107
|
declare const scope: ExecutionScope; // the one the composition root creates
|
|
108
108
|
|
|
109
|
+
const redact = [...CREDENTIAL_KEYS, 'iban'];
|
|
110
|
+
|
|
109
111
|
const instance = pino({
|
|
110
|
-
mixin: correlationMixin(() => traceLogFields(scope)),
|
|
111
|
-
redact: credentialRedaction(
|
|
112
|
+
mixin: correlationMixin(() => traceLogFields(scope), redact),
|
|
113
|
+
redact: credentialRedaction(redact),
|
|
112
114
|
});
|
|
113
115
|
|
|
114
|
-
export const logger = new PinoLogger(instance);
|
|
116
|
+
export const logger = new PinoLogger(instance, { redact });
|
|
115
117
|
```
|
|
116
118
|
|
|
119
|
+
The three take the same list: pino hides a key at the top of a line as the list writes it, and
|
|
120
|
+
the adapter and the mixin hide it there in any other case.
|
|
121
|
+
|
|
117
122
|
`createPinoLogger` writes `level` by its name and the message under `message`, like the
|
|
118
123
|
`StdoutLogger` of the aspects package and like `@ddd-ts-kit/winston`: one dashboard reads the
|
|
119
124
|
three. An instance of your own keeps the keys you gave it (`msg` and a numeric level by default).
|
|
@@ -226,11 +231,11 @@ one level below (`headers.authorization`, `body.password`):
|
|
|
226
231
|
`refreshToken`, `idToken`, `client_secret`, `clientSecret`, `client-secret`, `private_key`,
|
|
227
232
|
`privateKey`
|
|
228
233
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
+
`redact: ['iban', 'ssn']` adds to the list. Every name, of the list or added, is matched
|
|
235
|
+
whatever its case (`Authorization`, `X-Api-Key`, `IBAN`), at the top of a line and one level
|
|
236
|
+
below, by `hiddenKeys` of the kernel: `@ddd-ts-kit/winston` and `StdoutLogger` ask the same
|
|
237
|
+
function. Nothing is looked for deeper than one level, nor inside a list: log the part you
|
|
238
|
+
mean, not a whole request.
|
|
234
239
|
|
|
235
240
|
**An error passed as a field** (`logger.error('payment failed', { error })`: the `LogValue` of
|
|
236
241
|
the port admits an `Error`) is written as `describeError` of the kernel describes it, the same
|
|
@@ -296,9 +301,8 @@ process with nothing else to do, and what the shutdown does after the flush woul
|
|
|
296
301
|
`app.stop()` calls it, last, after the modules stopped and the error reporter was flushed:
|
|
297
302
|
stopping logs too. Without the application of the di package, call it yourself at that place.
|
|
298
303
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
with `asynchronous: true` it waits in the buffer for pino's exit hook.
|
|
304
|
+
A flush ends nothing, as the port says: a line logged after it is written like the others, and
|
|
305
|
+
with `asynchronous: true` it waits in the buffer for the next flush or for pino's exit hook.
|
|
302
306
|
|
|
303
307
|
## Performance
|
|
304
308
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type LogFields } from '@ddd-ts-kit/kernel';
|
|
2
2
|
/**
|
|
3
3
|
* A pino `mixin` reading the fields of the work in progress at each line that is written. A
|
|
4
4
|
* source that throws (no active span, no execution context) gives no field, never a lost line.
|
|
5
|
+
* `redact` names the keys hidden in addition to `CREDENTIAL_KEYS`, those `credentialRedaction`
|
|
6
|
+
* was given: among these fields they are hidden whatever their case.
|
|
5
7
|
*/
|
|
6
|
-
export declare function correlationMixin(fields: () => LogFields): () => LogFields;
|
|
8
|
+
export declare function correlationMixin(fields: () => LogFields, redact?: readonly string[]): () => LogFields;
|
|
7
9
|
//# sourceMappingURL=correlation-mixin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"correlation-mixin.d.ts","sourceRoot":"","sources":["../../src/correlation/correlation-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"correlation-mixin.d.ts","sourceRoot":"","sources":["../../src/correlation/correlation-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGhE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,SAAS,EAAE,MAAM,GAAE,SAAS,MAAM,EAAO,GAAG,MAAM,SAAS,CAWzG"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import { hiddenKeys } from '@ddd-ts-kit/kernel';
|
|
1
2
|
import { withoutCredentialsAtTop } from '../redaction/without-credentials-at-top.js';
|
|
2
3
|
/**
|
|
3
4
|
* A pino `mixin` reading the fields of the work in progress at each line that is written. A
|
|
4
5
|
* source that throws (no active span, no execution context) gives no field, never a lost line.
|
|
6
|
+
* `redact` names the keys hidden in addition to `CREDENTIAL_KEYS`, those `credentialRedaction`
|
|
7
|
+
* was given: among these fields they are hidden whatever their case.
|
|
5
8
|
*/
|
|
6
|
-
export function correlationMixin(fields) {
|
|
9
|
+
export function correlationMixin(fields, redact = []) {
|
|
10
|
+
const isHidden = hiddenKeys(redact);
|
|
7
11
|
return () => {
|
|
8
12
|
try {
|
|
9
13
|
// A copy: pino merges the fields of the line into the object the mixin answers.
|
|
10
|
-
return withoutCredentialsAtTop({ ...fields() });
|
|
14
|
+
return withoutCredentialsAtTop({ ...fields() }, isHidden);
|
|
11
15
|
}
|
|
12
16
|
catch {
|
|
13
17
|
return {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"correlation-mixin.js","sourceRoot":"","sources":["../../src/correlation/correlation-mixin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"correlation-mixin.js","sourceRoot":"","sources":["../../src/correlation/correlation-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAkB,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAuB,EAAE,MAAM,GAAsB,EAAE;IACtF,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IAEpC,OAAO,GAAG,EAAE;QACV,IAAI,CAAC;YACH,gFAAgF;YAChF,OAAO,uBAAuB,CAAC,EAAE,GAAG,MAAM,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;QAC5D,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -20,8 +20,6 @@ export interface CreatePinoLoggerOptions extends PinoLoggerOptions {
|
|
|
20
20
|
* `traceLogFields` of the tracing package or `logFieldsOf` of the current execution context.
|
|
21
21
|
*/
|
|
22
22
|
readonly fields?: () => LogFields;
|
|
23
|
-
/** Field names hidden in addition to `CREDENTIAL_KEYS`, at the top of a line and one level below. */
|
|
24
|
-
readonly redact?: readonly string[];
|
|
25
23
|
/**
|
|
26
24
|
* Buffers the lines and writes them off the hot path. Default `false`: every line is
|
|
27
25
|
* written before the call returns. See "Performance" in the README for what a crash loses.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-pino-logger.d.ts","sourceRoot":"","sources":["../src/create-pino-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,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,SAAS,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,SAAS,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAC;CAC5D;AAKD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,uBAA4B,GAAG,UAAU,CAUlF"}
|
|
@@ -11,7 +11,10 @@ const BUFFERED_BYTES = 4096;
|
|
|
11
11
|
*/
|
|
12
12
|
export function createPinoLogger(options = {}) {
|
|
13
13
|
const instance = pino(pinoOptions(options), options.format === 'pretty' ? prettyTransport(options) : destinationOf(options));
|
|
14
|
-
return new PinoLogger(instance,
|
|
14
|
+
return new PinoLogger(instance, {
|
|
15
|
+
...(options.scrubMessages === undefined ? {} : { scrubMessages: options.scrubMessages }),
|
|
16
|
+
...(options.redact === undefined ? {} : { redact: options.redact }),
|
|
17
|
+
});
|
|
15
18
|
}
|
|
16
19
|
function pinoOptions(options) {
|
|
17
20
|
return {
|
|
@@ -21,7 +24,7 @@ function pinoOptions(options) {
|
|
|
21
24
|
base: baseFields(options),
|
|
22
25
|
formatters: { level: (label) => ({ level: label }) },
|
|
23
26
|
redact: credentialRedaction([...CREDENTIAL_KEYS, ...(options.redact ?? [])]),
|
|
24
|
-
...(options.fields === undefined ? {} : { mixin: correlationMixin(options.fields) }),
|
|
27
|
+
...(options.fields === undefined ? {} : { mixin: correlationMixin(options.fields, options.redact) }),
|
|
25
28
|
};
|
|
26
29
|
}
|
|
27
30
|
function baseFields(options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-pino-logger.js","sourceRoot":"","sources":["../src/create-pino-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAiC,MAAM,oBAAoB,CAAC;AACpF,OAAO,EAAE,IAAI,E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AW,EAAE,OAAO,CAAC,WAAW,IAAI,eAAe;YACnD,UAAU,EAAE,SAAS;YACrB,aAAa,EAAE,gBAAgB;YAC/B,IAAI,EAAE,OAAO,CAAC,YAAY,KAAK,IAAI;SACpC;KACF,CAAC,CAAC;AACL,CAAC;AAED,SAAS,aAAa,CAAC,OAAgC;IACrD,IAAI,OAAO,OAAO,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;QAC5C,OAAO,OAAO,CAAC,WAAW,CAAC;IAC7B,CAAC;IAED,OAAO,IAAI,CAAC,WAAW,CAAC;QACtB,IAAI,EAAE,OAAO,CAAC,WAAW,IAAI,eAAe;QAC5C,IAAI,EAAE,OAAO,CAAC,YAAY,KAAK,IAAI;QACnC,GAAG,CAAC,OAAO,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxE,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type DescribeErrorOptions, type LogFields, type LogValue } from '@ddd-ts-kit/kernel';
|
|
1
|
+
import { type DescribeErrorOptions, type IsHiddenKey, type LogFields, type LogValue } from '@ddd-ts-kit/kernel';
|
|
2
2
|
/**
|
|
3
|
-
* The fields as pino receives them: errors described, the value of a
|
|
3
|
+
* The fields as pino receives them: errors described, the value of a hidden key replaced
|
|
4
4
|
* whatever its case, and no key that would forge the header. pino writes `level` and `time`
|
|
5
5
|
* before the fields: a field of that name would be a second key of the line, and the last one
|
|
6
6
|
* is read.
|
|
7
7
|
*/
|
|
8
|
-
export declare function lineFields(fields: LogFields, options: DescribeErrorOptions): Record<string, LogValue>;
|
|
8
|
+
export declare function lineFields(fields: LogFields, options: DescribeErrorOptions, isHidden: IsHiddenKey): Record<string, LogValue>;
|
|
9
9
|
//# sourceMappingURL=line-fields.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-fields.d.ts","sourceRoot":"","sources":["../../src/fields/line-fields.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"line-fields.d.ts","sourceRoot":"","sources":["../../src/fields/line-fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,QAAQ,EACd,MAAM,oBAAoB,CAAC;AAG5B;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,oBAAoB,EAC7B,QAAQ,EAAE,WAAW,GACpB,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAI1B"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { describeErrorFields } from '@ddd-ts-kit/kernel';
|
|
1
|
+
import { describeErrorFields, } from '@ddd-ts-kit/kernel';
|
|
2
2
|
import { withoutCredentialsAtTop } from '../redaction/without-credentials-at-top.js';
|
|
3
3
|
/**
|
|
4
|
-
* The fields as pino receives them: errors described, the value of a
|
|
4
|
+
* The fields as pino receives them: errors described, the value of a hidden key replaced
|
|
5
5
|
* whatever its case, and no key that would forge the header. pino writes `level` and `time`
|
|
6
6
|
* before the fields: a field of that name would be a second key of the line, and the last one
|
|
7
7
|
* is read.
|
|
8
8
|
*/
|
|
9
|
-
export function lineFields(fields, options) {
|
|
9
|
+
export function lineFields(fields, options, isHidden) {
|
|
10
10
|
const { level: _level, time: _time, ...line } = describeErrorFields(fields, options);
|
|
11
|
-
return withoutCredentialsAtTop(line);
|
|
11
|
+
return withoutCredentialsAtTop(line, isHidden);
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=line-fields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line-fields.js","sourceRoot":"","sources":["../../src/fields/line-fields.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"line-fields.js","sourceRoot":"","sources":["../../src/fields/line-fields.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,GAKpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CACxB,MAAiB,EACjB,OAA6B,EAC7B,QAAqB;IAErB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAErF,OAAO,uBAAuB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACjD,CAAC"}
|
package/dist/pino-logger.d.ts
CHANGED
|
@@ -6,6 +6,12 @@ export interface PinoLoggerOptions {
|
|
|
6
6
|
* `DomainError`. Default `false`: see "Privacy" in the README for the trade-off.
|
|
7
7
|
*/
|
|
8
8
|
readonly scrubMessages?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Field names hidden in addition to `CREDENTIAL_KEYS`, at the top of a line and one level
|
|
11
|
+
* below, whatever their case. Around an instance of yours, the keys its `credentialRedaction`
|
|
12
|
+
* was given: pino hides them as they are written, the adapter in any other case.
|
|
13
|
+
*/
|
|
14
|
+
readonly redact?: readonly string[];
|
|
9
15
|
}
|
|
10
16
|
/**
|
|
11
17
|
* The `Logger` port on a pino instance: the levels of the port are those of pino, a child is
|
|
@@ -16,6 +22,7 @@ export interface PinoLoggerOptions {
|
|
|
16
22
|
export declare class PinoLogger implements Logger {
|
|
17
23
|
private readonly options;
|
|
18
24
|
private readonly pino;
|
|
25
|
+
private readonly isHidden;
|
|
19
26
|
constructor(pino: Pino, options?: PinoLoggerOptions);
|
|
20
27
|
debug(message: string, fields?: LogFields): void;
|
|
21
28
|
info(message: string, fields?: LogFields): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pino-logger.d.ts","sourceRoot":"","sources":["../src/pino-logger.ts"],"names":[],"mappings":"AAAA,O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b,OAAO,CAAC,kBAAkB;CAO3B"}
|
package/dist/pino-logger.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UNWRITABLE_FIELDS } from '@ddd-ts-kit/kernel';
|
|
1
|
+
import { UNWRITABLE_FIELDS, hiddenKeys, } from '@ddd-ts-kit/kernel';
|
|
2
2
|
import { lineFields } from './fields/line-fields.js';
|
|
3
3
|
import { holdWhileFlushing } from './hold-while-flushing.js';
|
|
4
4
|
/** Children of an instance the adapter already prepared: they are adopted as they are. */
|
|
@@ -12,9 +12,11 @@ const adopted = new WeakSet();
|
|
|
12
12
|
export class PinoLogger {
|
|
13
13
|
options;
|
|
14
14
|
pino;
|
|
15
|
+
isHidden;
|
|
15
16
|
constructor(pino, options = {}) {
|
|
16
17
|
this.options = options;
|
|
17
18
|
this.pino = adopted.has(pino) ? pino : describingErrorsItself(pino);
|
|
19
|
+
this.isHidden = hiddenKeys(options.redact);
|
|
18
20
|
}
|
|
19
21
|
debug(message, fields) {
|
|
20
22
|
this.write('debug', message, fields);
|
|
@@ -56,7 +58,7 @@ export class PinoLogger {
|
|
|
56
58
|
}
|
|
57
59
|
nativeChild(fields) {
|
|
58
60
|
try {
|
|
59
|
-
return this.pino.child(lineFields(fields, this.options));
|
|
61
|
+
return this.pino.child(lineFields(fields, this.options, this.isHidden));
|
|
60
62
|
}
|
|
61
63
|
catch {
|
|
62
64
|
return this.pino.child(UNWRITABLE_FIELDS);
|
|
@@ -67,7 +69,7 @@ export class PinoLogger {
|
|
|
67
69
|
return;
|
|
68
70
|
}
|
|
69
71
|
try {
|
|
70
|
-
this.pino[level](lineFields(fields, this.options), message);
|
|
72
|
+
this.pino[level](lineFields(fields, this.options, this.isHidden), message);
|
|
71
73
|
}
|
|
72
74
|
catch {
|
|
73
75
|
this.writeWithoutFields(level, message);
|
package/dist/pino-logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pino-logger.js","sourceRoot":"","sources":["../src/pino-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AAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;QAC7E,CAAC;QAAC,MAAM,CAAC;YACP,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IAEO,kBAAkB,CAAC,KAAe,EAAE,OAAe;QACzD,IAAI,CAAC;YACH,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;QACT,CAAC;IACH,CAAC;CACF;AAED;;;;GAIG;AACH,SAAS,sBAAsB,CAAC,IAAU;IACxC,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,CAAC,WAAoB,EAAE,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AACzF,CAAC"}
|
|
@@ -7,9 +7,10 @@ export interface CredentialRedaction {
|
|
|
7
7
|
* The pino `redact` option hiding `CREDENTIAL_KEYS` and the given keys at the top of a line and
|
|
8
8
|
* one level below, in the fields of an entry, of a child and of the mixin alike. At the top a
|
|
9
9
|
* path names each key as it is written: pino gives the censor of a wildcard at the top no key
|
|
10
|
-
* name
|
|
11
|
-
*
|
|
12
|
-
* case: a wildcard path per key would cost pino as many
|
|
10
|
+
* name. `PinoLogger` and `correlationMixin`, given the same keys, hide them there whatever their
|
|
11
|
+
* case before pino sees the fields. The level below is one wildcard path whose censor asks
|
|
12
|
+
* `hiddenKeys` of the kernel, without case: a wildcard path per key would cost pino as many
|
|
13
|
+
* passes over each line.
|
|
13
14
|
*/
|
|
14
15
|
export declare function credentialRedaction(keys?: readonly string[]): CredentialRedaction;
|
|
15
16
|
//# sourceMappingURL=credential-redaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-redaction.d.ts","sourceRoot":"","sources":["../../src/redaction/credential-redaction.ts"],"names":[],"mappings":"AAEA,+CAA+C;AAC/C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IACzB,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC;CAC1D;AAID
|
|
1
|
+
{"version":3,"file":"credential-redaction.d.ts","sourceRoot":"","sources":["../../src/redaction/credential-redaction.ts"],"names":[],"mappings":"AAEA,+CAA+C;AAC/C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IACzB,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC;CAC1D;AAID;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,GAAE,SAAS,MAAM,EAAoB,GAAG,mBAAmB,CAQlG"}
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import { CREDENTIAL_KEYS, REDACTED,
|
|
1
|
+
import { CREDENTIAL_KEYS, REDACTED, hiddenKeys } from '@ddd-ts-kit/kernel';
|
|
2
2
|
const ONE_LEVEL_BELOW = '*.*';
|
|
3
3
|
/**
|
|
4
4
|
* The pino `redact` option hiding `CREDENTIAL_KEYS` and the given keys at the top of a line and
|
|
5
5
|
* one level below, in the fields of an entry, of a child and of the mixin alike. At the top a
|
|
6
6
|
* path names each key as it is written: pino gives the censor of a wildcard at the top no key
|
|
7
|
-
* name
|
|
8
|
-
*
|
|
9
|
-
* case: a wildcard path per key would cost pino as many
|
|
7
|
+
* name. `PinoLogger` and `correlationMixin`, given the same keys, hide them there whatever their
|
|
8
|
+
* case before pino sees the fields. The level below is one wildcard path whose censor asks
|
|
9
|
+
* `hiddenKeys` of the kernel, without case: a wildcard path per key would cost pino as many
|
|
10
|
+
* passes over each line.
|
|
10
11
|
*/
|
|
11
12
|
export function credentialRedaction(keys = CREDENTIAL_KEYS) {
|
|
12
13
|
const named = [...new Set([...CREDENTIAL_KEYS, ...keys])];
|
|
13
|
-
const
|
|
14
|
+
const isHidden = hiddenKeys(keys);
|
|
14
15
|
return {
|
|
15
16
|
paths: [...named.map((key) => `["${key}"]`), ONE_LEVEL_BELOW],
|
|
16
|
-
censor: (value, path) =>
|
|
17
|
-
const name = path.at(-1) ?? '';
|
|
18
|
-
return isCredentialKey(name) || added.has(name.toLowerCase()) ? REDACTED : value;
|
|
19
|
-
},
|
|
17
|
+
censor: (value, path) => (isHidden(path.at(-1) ?? '') ? REDACTED : value),
|
|
20
18
|
};
|
|
21
19
|
}
|
|
22
20
|
//# sourceMappingURL=credential-redaction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-redaction.js","sourceRoot":"","sources":["../../src/redaction/credential-redaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"credential-redaction.js","sourceRoot":"","sources":["../../src/redaction/credential-redaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAQ3E,MAAM,eAAe,GAAG,KAAK,CAAC;AAE9B;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAI,GAAsB,eAAe;IAC3E,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,eAAe,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1D,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAElC,OAAO;QACL,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,eAAe,CAAC;QAC7D,MAAM,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;KAC1E,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { type IsHiddenKey } from '@ddd-ts-kit/kernel';
|
|
1
2
|
/**
|
|
2
|
-
* Hides, in fields the adapter owns, the value of every key
|
|
3
|
-
*
|
|
3
|
+
* Hides, in fields the adapter owns, the value of every key that is hidden, whatever its case:
|
|
4
|
+
* the paths of pino name each key at the top as it is written.
|
|
4
5
|
*/
|
|
5
|
-
export declare function withoutCredentialsAtTop<Fields extends object>(fields: Fields): Fields;
|
|
6
|
+
export declare function withoutCredentialsAtTop<Fields extends object>(fields: Fields, isHidden: IsHiddenKey): Fields;
|
|
6
7
|
//# sourceMappingURL=without-credentials-at-top.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"without-credentials-at-top.d.ts","sourceRoot":"","sources":["../../src/redaction/without-credentials-at-top.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"without-credentials-at-top.d.ts","sourceRoot":"","sources":["../../src/redaction/without-credentials-at-top.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEhE;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,SAAS,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,GAAG,MAAM,CAQ5G"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { REDACTED
|
|
1
|
+
import { REDACTED } from '@ddd-ts-kit/kernel';
|
|
2
2
|
/**
|
|
3
|
-
* Hides, in fields the adapter owns, the value of every key
|
|
4
|
-
*
|
|
3
|
+
* Hides, in fields the adapter owns, the value of every key that is hidden, whatever its case:
|
|
4
|
+
* the paths of pino name each key at the top as it is written.
|
|
5
5
|
*/
|
|
6
|
-
export function withoutCredentialsAtTop(fields) {
|
|
6
|
+
export function withoutCredentialsAtTop(fields, isHidden) {
|
|
7
7
|
for (const key of Object.keys(fields)) {
|
|
8
|
-
if (
|
|
8
|
+
if (isHidden(key)) {
|
|
9
9
|
Object.assign(fields, { [key]: REDACTED });
|
|
10
10
|
}
|
|
11
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"without-credentials-at-top.js","sourceRoot":"","sources":["../../src/redaction/without-credentials-at-top.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"without-credentials-at-top.js","sourceRoot":"","sources":["../../src/redaction/without-credentials-at-top.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAoB,MAAM,oBAAoB,CAAC;AAEhE;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAwB,MAAc,EAAE,QAAqB;IAClG,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAClB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ddd-ts-kit/pino",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.116.0",
|
|
4
4
|
"description": "Adapter of the kernel Logger port on pino, with trace and execution correlation on every line.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ddd",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"dist"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@ddd-ts-kit/kernel": "0.
|
|
43
|
+
"@ddd-ts-kit/kernel": "0.116.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@ddd-ts-kit/testing": "0.
|
|
46
|
+
"@ddd-ts-kit/testing": "0.116.0",
|
|
47
47
|
"pino": "^10.4.0",
|
|
48
48
|
"pino-pretty": "^13.2.0"
|
|
49
49
|
},
|