@ddd-ts-kit/pino 0.86.0 → 0.88.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 +5 -2
- package/README.md +4 -1
- package/dist/hold-while-flushing.d.ts +9 -0
- package/dist/hold-while-flushing.d.ts.map +1 -0
- package/dist/hold-while-flushing.js +16 -0
- package/dist/hold-while-flushing.js.map +1 -0
- package/dist/pino-logger.d.ts.map +1 -1
- package/dist/pino-logger.js +3 -1
- package/dist/pino-logger.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:8fe829429d03f69b -->
|
|
3
3
|
|
|
4
4
|
# @ddd-ts-kit/pino
|
|
5
5
|
|
|
@@ -296,7 +296,10 @@ l'en-tête d'une ligne.
|
|
|
296
296
|
|
|
297
297
|
`flush(): Promise<void>` se résout une fois que ce que pino avait mis en tampon a été confié à sa
|
|
298
298
|
destination : le *worker* d'un transport, ou le tampon d'une destination asynchrone. Il ne rejette
|
|
299
|
-
jamais.
|
|
299
|
+
jamais. Pendant qu'il s'exécute, il garde le processus en vie, dix secondes au plus : pino ne
|
|
300
|
+
laisse pas le *worker* d'un transport retenir un processus, si bien que la réponse de ce *worker*
|
|
301
|
+
arriverait sinon trop tard dans un processus qui n'a rien d'autre à faire, et ce que l'arrêt fait
|
|
302
|
+
après le vidage ne s'exécuterait jamais. `app.stop()` l'appelle, en dernier, après l'arrêt des modules et le vidage du rapporteur
|
|
300
303
|
d'erreurs : l'arrêt journalise lui aussi. Sans l'application du *package* di, appelez-le
|
|
301
304
|
vous-même à cet endroit.
|
|
302
305
|
|
package/README.md
CHANGED
|
@@ -283,7 +283,10 @@ so that no field forges the header of a line.
|
|
|
283
283
|
## Flush
|
|
284
284
|
|
|
285
285
|
`flush(): Promise<void>` resolves once what pino buffered was handed to its destination: the
|
|
286
|
-
worker of a transport, or the buffer of an asynchronous destination. It never rejects.
|
|
286
|
+
worker of a transport, or the buffer of an asynchronous destination. It never rejects. While it
|
|
287
|
+
runs, it keeps the process alive, ten seconds at most: pino does not let the worker of a
|
|
288
|
+
transport hold a process, so the answer of that worker would otherwise come too late in a
|
|
289
|
+
process with nothing else to do, and what the shutdown does after the flush would never run.
|
|
287
290
|
`app.stop()` calls it, last, after the modules stopped and the error reporter was flushed:
|
|
288
291
|
stopping logs too. Without the application of the di package, call it yourself at that place.
|
|
289
292
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keeps the process alive while a flush is under way. Pino unreferences the worker thread of a
|
|
3
|
+
* transport (`pino-pretty`) so that it never holds a process: its answer to a flush does not
|
|
4
|
+
* either, and a process with nothing else pending exited before the flush resolved, skipping
|
|
5
|
+
* what its shutdown does after it. A flush that never answers holds it ten seconds, no more.
|
|
6
|
+
* Answers what releases the hold.
|
|
7
|
+
*/
|
|
8
|
+
export declare function holdWhileFlushing(): () => void;
|
|
9
|
+
//# sourceMappingURL=hold-while-flushing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hold-while-flushing.d.ts","sourceRoot":"","sources":["../src/hold-while-flushing.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,IAAI,CAM9C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** The longest a flush keeps a process alive. */
|
|
2
|
+
const HOLD_MS = 10_000;
|
|
3
|
+
/**
|
|
4
|
+
* Keeps the process alive while a flush is under way. Pino unreferences the worker thread of a
|
|
5
|
+
* transport (`pino-pretty`) so that it never holds a process: its answer to a flush does not
|
|
6
|
+
* either, and a process with nothing else pending exited before the flush resolved, skipping
|
|
7
|
+
* what its shutdown does after it. A flush that never answers holds it ten seconds, no more.
|
|
8
|
+
* Answers what releases the hold.
|
|
9
|
+
*/
|
|
10
|
+
export function holdWhileFlushing() {
|
|
11
|
+
const timer = setTimeout(() => undefined, HOLD_MS);
|
|
12
|
+
return () => {
|
|
13
|
+
clearTimeout(timer);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=hold-while-flushing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hold-while-flushing.js","sourceRoot":"","sources":["../src/hold-while-flushing.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,MAAM,OAAO,GAAG,MAAM,CAAC;AAEvB;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAEnD,OAAO,GAAG,EAAE;QACV,YAAY,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pino-logger.d.ts","sourceRoot":"","sources":["../src/pino-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACnG,OAAO,KAAK,EAAE,MAAM,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"pino-logger.d.ts","sourceRoot":"","sources":["../src/pino-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACnG,OAAO,KAAK,EAAE,MAAM,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAI3C,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;CAClC;AAKD;;;;;GAKG;AACH,qBAAa,UAAW,YAAW,MAAM;IAKrC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJ1B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAO;IAE5B,YACE,IAAI,EAAE,IAAI,EACO,OAAO,GAAE,iBAAsB,EAGjD;IAED,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,IAAI,CAE/C;IAED,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,IAAI,CAE9C;IAED,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,IAAI,CAE9C;IAED,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,IAAI,CAE/C;IAED,KAAK,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAMnC;IAED,6EAA6E;IAC7E,cAAc,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAEvC;IAED;;;OAGG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAYrB;IAED,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,KAAK;IAYb,OAAO,CAAC,kBAAkB;CAO3B"}
|
package/dist/pino-logger.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { UNWRITABLE_FIELDS } from '@ddd-ts-kit/kernel';
|
|
2
2
|
import { lineFields } from './fields/line-fields.js';
|
|
3
|
+
import { holdWhileFlushing } from './hold-while-flushing.js';
|
|
3
4
|
/** Children of an instance the adapter already prepared: they are adopted as they are. */
|
|
4
5
|
const adopted = new WeakSet();
|
|
5
6
|
/**
|
|
@@ -41,6 +42,7 @@ export class PinoLogger {
|
|
|
41
42
|
* logger stays usable: an entry logged afterwards is written like the others.
|
|
42
43
|
*/
|
|
43
44
|
flush() {
|
|
45
|
+
const release = holdWhileFlushing();
|
|
44
46
|
return new Promise((resolve) => {
|
|
45
47
|
try {
|
|
46
48
|
this.pino.flush(() => {
|
|
@@ -50,7 +52,7 @@ export class PinoLogger {
|
|
|
50
52
|
catch {
|
|
51
53
|
resolve();
|
|
52
54
|
}
|
|
53
|
-
});
|
|
55
|
+
}).finally(release);
|
|
54
56
|
}
|
|
55
57
|
nativeChild(fields) {
|
|
56
58
|
try {
|
package/dist/pino-logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pino-logger.js","sourceRoot":"","sources":["../src/pino-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA8C,MAAM,oBAAoB,CAAC;AAEnG,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"pino-logger.js","sourceRoot":"","sources":["../src/pino-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA8C,MAAM,oBAAoB,CAAC;AAEnG,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAU1D,0FAA0F;AAC1F,MAAM,OAAO,GAAG,IAAI,OAAO,EAAQ,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,OAAO,UAAU;IAKF,OAAO;IAJT,IAAI,CAAO;IAE5B,YACE,IAAU,EACO,OAAO,GAAsB,EAAE;uBAA/B,OAAO;QAExB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;IACtE,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,MAAkB;QACvC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,CAAC,OAAe,EAAE,MAAkB;QACtC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;I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;IACH,CAAC;IAEO,KAAK,CAAC,KAAe,EAAE,OAAe,EAAE,MAAM,GAAc,EAAE;QACpE,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;YAChC,OAAO;QACT,CAAC;QAED,IAAI,CAAC;YACH,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;QAC9D,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ddd-ts-kit/pino",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.88.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",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@ddd-ts-kit/kernel": "0.
|
|
40
|
+
"@ddd-ts-kit/kernel": "0.88.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@ddd-ts-kit/testing": "0.
|
|
43
|
+
"@ddd-ts-kit/testing": "0.88.0",
|
|
44
44
|
"pino": "^10.4.0",
|
|
45
45
|
"pino-pretty": "^13.2.0"
|
|
46
46
|
},
|