@wbce/projen-d9 0.0.28 → 0.1.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/.jsii +184 -45
- package/API.md +153 -37
- package/CHANGELOG.md +13 -0
- package/README.md +10 -3
- package/docs/D9-plumbing.md +189 -0
- package/lib/cli/atlas.d.ts +10 -0
- package/lib/cli/atlas.js +65 -0
- package/lib/cli/commands/cedar/cedar-format.d.ts +7 -0
- package/lib/cli/commands/cedar/cedar-format.js +75 -0
- package/lib/cli/commands/cedar/cedar-to-d9-translations.d.ts +12 -0
- package/lib/cli/commands/cedar/cedar-to-d9-translations.js +130 -0
- package/lib/cli/commands/cedar/cedar-to-d9.d.ts +57 -0
- package/lib/cli/commands/cedar/cedar-to-d9.js +221 -0
- package/lib/cli/commands/cedar/cedar-translations.d.ts +9 -0
- package/lib/cli/commands/cedar/cedar-translations.js +213 -0
- package/lib/cli/commands/cedar/d9-permission.d.ts +27 -0
- package/lib/cli/commands/cedar/d9-permission.js +45 -0
- package/lib/cli/commands/cedar/d9-to-cedar.d.ts +33 -0
- package/lib/cli/commands/cedar/d9-to-cedar.js +157 -0
- package/lib/cli/commands/cedar/roles-table.d.ts +14 -0
- package/lib/cli/commands/cedar/roles-table.js +29 -0
- package/lib/cli/commands/save/apply-snapshot.js +39 -30
- package/lib/cli/commands/save/check-unsaved.d.ts +9 -0
- package/lib/cli/commands/save/check-unsaved.js +81 -0
- package/lib/cli/commands/save/env.d.ts +33 -0
- package/lib/cli/commands/save/env.js +109 -0
- package/lib/cli/commands/save/save-snapshot.d.ts +9 -0
- package/lib/cli/commands/save/save-snapshot.js +232 -0
- package/lib/cli/commands/save/sync-files.d.ts +5 -0
- package/lib/cli/commands/save/sync-files.js +46 -0
- package/lib/cli/commands/save/transfer.d.ts +18 -0
- package/lib/cli/commands/save/transfer.js +96 -0
- package/lib/cli/commands/save/utils.d.ts +5 -0
- package/lib/cli/commands/save/utils.js +33 -3
- package/lib/cli/commands/sync.js +4 -3
- package/lib/cli/index.js +65 -25
- package/lib/cli/logger.d.ts +2 -0
- package/lib/cli/logger.js +10 -0
- package/lib/cli/plumbing-config.d.ts +11 -0
- package/lib/cli/plumbing-config.js +13 -0
- package/lib/index.d.ts +44 -5
- package/lib/index.js +54 -41
- package/node_modules/@cedar-policy/cedar-wasm/README.md +181 -0
- package/node_modules/@cedar-policy/cedar-wasm/esm/README.md +181 -0
- package/node_modules/@cedar-policy/cedar-wasm/esm/cedar_wasm.d.ts +427 -0
- package/node_modules/@cedar-policy/cedar-wasm/esm/cedar_wasm.js +9 -0
- package/node_modules/@cedar-policy/cedar-wasm/esm/cedar_wasm_bg.js +434 -0
- package/node_modules/@cedar-policy/cedar-wasm/esm/cedar_wasm_bg.wasm +0 -0
- package/node_modules/@cedar-policy/cedar-wasm/esm/cedar_wasm_bg.wasm.d.ts +34 -0
- package/node_modules/@cedar-policy/cedar-wasm/esm/package.json +23 -0
- package/node_modules/@cedar-policy/cedar-wasm/nodejs/README.md +181 -0
- package/node_modules/@cedar-policy/cedar-wasm/nodejs/cedar_wasm.d.ts +427 -0
- package/node_modules/@cedar-policy/cedar-wasm/nodejs/cedar_wasm.js +463 -0
- package/node_modules/@cedar-policy/cedar-wasm/nodejs/cedar_wasm_bg.wasm +0 -0
- package/node_modules/@cedar-policy/cedar-wasm/nodejs/cedar_wasm_bg.wasm.d.ts +34 -0
- package/node_modules/@cedar-policy/cedar-wasm/nodejs/package.json +18 -0
- package/node_modules/@cedar-policy/cedar-wasm/package.json +53 -0
- package/node_modules/@cedar-policy/cedar-wasm/web/README.md +181 -0
- package/node_modules/@cedar-policy/cedar-wasm/web/cedar_wasm.d.ts +486 -0
- package/node_modules/@cedar-policy/cedar-wasm/web/cedar_wasm.js +534 -0
- package/node_modules/@cedar-policy/cedar-wasm/web/cedar_wasm_bg.wasm +0 -0
- package/node_modules/@cedar-policy/cedar-wasm/web/cedar_wasm_bg.wasm.d.ts +34 -0
- package/node_modules/@cedar-policy/cedar-wasm/web/package.json +21 -0
- package/node_modules/@types/node/README.md +5 -6
- package/node_modules/@types/node/assert/strict.d.ts +111 -0
- package/node_modules/@types/node/assert.d.ts +1040 -79
- package/node_modules/@types/node/async_hooks.d.ts +476 -119
- package/node_modules/@types/node/buffer.buffer.d.ts +472 -0
- package/node_modules/@types/node/buffer.d.ts +1925 -13
- package/node_modules/@types/node/child_process.d.ts +1204 -235
- package/node_modules/@types/node/cluster.d.ts +455 -137
- package/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
- package/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- package/node_modules/@types/node/compatibility/iterators.d.ts +20 -0
- package/node_modules/@types/node/console.d.ts +450 -1
- package/node_modules/@types/node/constants.d.ts +20 -447
- package/node_modules/@types/node/crypto.d.ts +3962 -600
- package/node_modules/@types/node/dgram.d.ts +515 -33
- package/node_modules/@types/node/diagnostics_channel.d.ts +578 -0
- package/node_modules/@types/node/dns/promises.d.ts +503 -0
- package/node_modules/@types/node/dns.d.ts +798 -247
- package/node_modules/@types/node/domain.d.ts +164 -10
- package/node_modules/@types/node/events.d.ts +954 -25
- package/node_modules/@types/node/fs/promises.d.ts +1295 -0
- package/node_modules/@types/node/fs.d.ts +3463 -1569
- package/node_modules/@types/node/globals.d.ts +98 -1277
- package/node_modules/@types/node/globals.typedarray.d.ts +38 -0
- package/node_modules/@types/node/http.d.ts +1933 -300
- package/node_modules/@types/node/http2.d.ts +1946 -254
- package/node_modules/@types/node/https.d.ts +557 -134
- package/node_modules/@types/node/index.d.ts +54 -48
- package/node_modules/@types/node/inspector.d.ts +227 -3014
- package/node_modules/@types/node/inspector.generated.d.ts +4052 -0
- package/node_modules/@types/node/module.d.ts +890 -2
- package/node_modules/@types/node/net.d.ts +872 -105
- package/node_modules/@types/node/os.d.ts +452 -209
- package/node_modules/@types/node/package.json +78 -128
- package/node_modules/@types/node/path.d.ts +196 -155
- package/node_modules/@types/node/perf_hooks.d.ts +829 -120
- package/node_modules/@types/node/process.d.ts +2072 -3
- package/node_modules/@types/node/punycode.d.ts +69 -27
- package/node_modules/@types/node/querystring.d.ts +132 -9
- package/node_modules/@types/node/readline/promises.d.ts +161 -0
- package/node_modules/@types/node/readline.d.ts +485 -49
- package/node_modules/@types/node/repl.d.ts +121 -83
- package/node_modules/@types/node/sea.d.ts +153 -0
- package/node_modules/@types/node/sqlite.d.ts +721 -0
- package/node_modules/@types/node/stream/consumers.d.ts +38 -0
- package/node_modules/@types/node/stream/promises.d.ts +90 -0
- package/node_modules/@types/node/stream/web.d.ts +622 -0
- package/node_modules/@types/node/stream.d.ts +1470 -140
- package/node_modules/@types/node/string_decoder.d.ts +64 -4
- package/node_modules/@types/node/test.d.ts +2163 -0
- package/node_modules/@types/node/timers/promises.d.ts +108 -0
- package/node_modules/@types/node/timers.d.ts +284 -13
- package/node_modules/@types/node/tls.d.ts +850 -244
- package/node_modules/@types/node/trace_events.d.ts +147 -11
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +34 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +97 -0
- package/node_modules/@types/node/tty.d.ts +160 -18
- package/node_modules/@types/node/url.d.ts +890 -53
- package/node_modules/@types/node/util.d.ts +2566 -160
- package/node_modules/@types/node/v8.d.ts +806 -83
- package/node_modules/@types/node/vm.d.ts +932 -44
- package/node_modules/@types/node/wasi.d.ts +148 -22
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
- package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/node_modules/@types/node/web-globals/events.d.ts +97 -0
- package/node_modules/@types/node/web-globals/fetch.d.ts +55 -0
- package/node_modules/@types/node/web-globals/navigator.d.ts +22 -0
- package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
- package/node_modules/@types/node/worker_threads.d.ts +657 -80
- package/node_modules/@types/node/zlib.d.ts +510 -119
- package/node_modules/pino/.nojekyll +0 -0
- package/node_modules/pino/.prettierignore +1 -0
- package/node_modules/pino/CNAME +1 -0
- package/node_modules/pino/CONTRIBUTING.md +34 -0
- package/node_modules/pino/LICENSE +21 -0
- package/node_modules/pino/README.md +177 -0
- package/node_modules/pino/SECURITY.md +103 -0
- package/node_modules/pino/benchmarks/basic.bench.js +95 -0
- package/node_modules/pino/benchmarks/child-child.bench.js +52 -0
- package/node_modules/pino/benchmarks/child-creation.bench.js +73 -0
- package/node_modules/pino/benchmarks/child.bench.js +62 -0
- package/node_modules/pino/benchmarks/deep-object.bench.js +88 -0
- package/node_modules/pino/benchmarks/formatters.bench.js +50 -0
- package/node_modules/pino/benchmarks/internal/custom-levels.js +67 -0
- package/node_modules/pino/benchmarks/internal/just-pino-heavy.bench.js +76 -0
- package/node_modules/pino/benchmarks/internal/just-pino.bench.js +182 -0
- package/node_modules/pino/benchmarks/internal/parent-vs-child.bench.js +75 -0
- package/node_modules/pino/benchmarks/internal/redact.bench.js +86 -0
- package/node_modules/pino/benchmarks/long-string.bench.js +81 -0
- package/node_modules/pino/benchmarks/multi-arg.bench.js +193 -0
- package/node_modules/pino/benchmarks/multistream.js +98 -0
- package/node_modules/pino/benchmarks/object.bench.js +82 -0
- package/node_modules/pino/benchmarks/utils/generate-benchmark-doc.js +36 -0
- package/node_modules/pino/benchmarks/utils/runbench.js +138 -0
- package/node_modules/pino/benchmarks/utils/wrap-log-level.js +55 -0
- package/node_modules/pino/bin.js +6 -0
- package/node_modules/pino/browser.js +607 -0
- package/node_modules/pino/build/sync-version.js +25 -0
- package/node_modules/pino/docs/api.md +1664 -0
- package/node_modules/pino/docs/asynchronous.md +55 -0
- package/node_modules/pino/docs/benchmarks.md +55 -0
- package/node_modules/pino/docs/browser.md +341 -0
- package/node_modules/pino/docs/bundling.md +40 -0
- package/node_modules/pino/docs/child-loggers.md +116 -0
- package/node_modules/pino/docs/diagnostics.md +16 -0
- package/node_modules/pino/docs/ecosystem.md +87 -0
- package/node_modules/pino/docs/help.md +353 -0
- package/node_modules/pino/docs/lts.md +93 -0
- package/node_modules/pino/docs/pretty.md +38 -0
- package/node_modules/pino/docs/redaction.md +130 -0
- package/node_modules/pino/docs/transports.md +1447 -0
- package/node_modules/pino/docs/web.md +306 -0
- package/node_modules/pino/eslint.config.js +36 -0
- package/node_modules/pino/examples/basic.js +43 -0
- package/node_modules/pino/examples/transport.js +68 -0
- package/node_modules/pino/favicon.ico +0 -0
- package/node_modules/pino/file.js +12 -0
- package/node_modules/pino/inc-version.sh +42 -0
- package/node_modules/pino/index.html +55 -0
- package/node_modules/pino/lib/caller.js +40 -0
- package/node_modules/pino/lib/constants.js +28 -0
- package/node_modules/pino/lib/deprecations.js +8 -0
- package/node_modules/pino/lib/levels.js +241 -0
- package/node_modules/pino/lib/meta.js +3 -0
- package/node_modules/pino/lib/multistream.js +211 -0
- package/node_modules/pino/lib/proto.js +256 -0
- package/node_modules/pino/lib/redaction.js +119 -0
- package/node_modules/pino/lib/symbols.js +76 -0
- package/node_modules/pino/lib/time.js +39 -0
- package/node_modules/pino/lib/tools.js +427 -0
- package/node_modules/pino/lib/transport-stream.js +56 -0
- package/node_modules/pino/lib/transport.js +302 -0
- package/node_modules/pino/lib/worker.js +197 -0
- package/node_modules/pino/package.json +112 -0
- package/node_modules/pino/pino.d.ts +881 -0
- package/node_modules/pino/pino.js +259 -0
- package/node_modules/pino/test/basic.test.js +952 -0
- package/node_modules/pino/test/broken-pipe.test.js +59 -0
- package/node_modules/pino/test/browser-bindings.test.js +114 -0
- package/node_modules/pino/test/browser-child.test.js +132 -0
- package/node_modules/pino/test/browser-disabled.test.js +87 -0
- package/node_modules/pino/test/browser-early-console-freeze.test.js +12 -0
- package/node_modules/pino/test/browser-is-level-enabled.test.js +101 -0
- package/node_modules/pino/test/browser-levels.test.js +241 -0
- package/node_modules/pino/test/browser-redaction.test.js +264 -0
- package/node_modules/pino/test/browser-serializers.test.js +352 -0
- package/node_modules/pino/test/browser-set-bindings.test.js +99 -0
- package/node_modules/pino/test/browser-timestamp.test.js +88 -0
- package/node_modules/pino/test/browser-transmit.test.js +417 -0
- package/node_modules/pino/test/browser.test.js +698 -0
- package/node_modules/pino/test/caller.test.js +20 -0
- package/node_modules/pino/test/complex-objects.test.js +36 -0
- package/node_modules/pino/test/crlf.test.js +34 -0
- package/node_modules/pino/test/custom-levels.test.js +267 -0
- package/node_modules/pino/test/diagnostics.test.js +107 -0
- package/node_modules/pino/test/error-key.test.js +37 -0
- package/node_modules/pino/test/error.test.js +403 -0
- package/node_modules/pino/test/escaping.test.js +110 -0
- package/node_modules/pino/test/esm/esm.mjs +14 -0
- package/node_modules/pino/test/esm/index.test.js +21 -0
- package/node_modules/pino/test/esm/named-exports.mjs +29 -0
- package/node_modules/pino/test/exit.test.js +79 -0
- package/node_modules/pino/test/fixtures/broken-pipe/basic.js +9 -0
- package/node_modules/pino/test/fixtures/broken-pipe/destination.js +10 -0
- package/node_modules/pino/test/fixtures/broken-pipe/syncfalse.js +12 -0
- package/node_modules/pino/test/fixtures/caller-loop.js +6 -0
- package/node_modules/pino/test/fixtures/console-transport.js +13 -0
- package/node_modules/pino/test/fixtures/crashing-transport.js +13 -0
- package/node_modules/pino/test/fixtures/default-exit.js +8 -0
- package/node_modules/pino/test/fixtures/destination-exit.js +8 -0
- package/node_modules/pino/test/fixtures/eval/index.js +13 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/14-files.js +3 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/2-files.js +3 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file1.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file10.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file11.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file12.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file13.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file14.js +11 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file2.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file3.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file4.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file5.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file6.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file7.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file8.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file9.js +5 -0
- package/node_modules/pino/test/fixtures/noop-transport.js +10 -0
- package/node_modules/pino/test/fixtures/pretty/null-prototype.js +8 -0
- package/node_modules/pino/test/fixtures/stdout-hack-protection.js +11 -0
- package/node_modules/pino/test/fixtures/syncfalse-child.js +6 -0
- package/node_modules/pino/test/fixtures/syncfalse-exit.js +9 -0
- package/node_modules/pino/test/fixtures/syncfalse-flush-exit.js +10 -0
- package/node_modules/pino/test/fixtures/syncfalse.js +6 -0
- package/node_modules/pino/test/fixtures/syntax-error-esm.mjs +2 -0
- package/node_modules/pino/test/fixtures/to-file-transport-with-transform.js +20 -0
- package/node_modules/pino/test/fixtures/to-file-transport.js +13 -0
- package/node_modules/pino/test/fixtures/to-file-transport.mjs +8 -0
- package/node_modules/pino/test/fixtures/transport/index.js +12 -0
- package/node_modules/pino/test/fixtures/transport/package.json +5 -0
- package/node_modules/pino/test/fixtures/transport-exit-immediately-with-async-dest.js +16 -0
- package/node_modules/pino/test/fixtures/transport-exit-immediately.js +11 -0
- package/node_modules/pino/test/fixtures/transport-exit-on-ready.js +12 -0
- package/node_modules/pino/test/fixtures/transport-invalid-node-options.js +26 -0
- package/node_modules/pino/test/fixtures/transport-main.js +9 -0
- package/node_modules/pino/test/fixtures/transport-many-lines.js +29 -0
- package/node_modules/pino/test/fixtures/transport-preload-main.mjs +13 -0
- package/node_modules/pino/test/fixtures/transport-preload.mjs +13 -0
- package/node_modules/pino/test/fixtures/transport-string-stdout.js +9 -0
- package/node_modules/pino/test/fixtures/transport-transform.js +21 -0
- package/node_modules/pino/test/fixtures/transport-uses-pino-config.js +33 -0
- package/node_modules/pino/test/fixtures/transport-with-on-exit.js +12 -0
- package/node_modules/pino/test/fixtures/transport-worker-data.js +19 -0
- package/node_modules/pino/test/fixtures/transport-worker-name.js +24 -0
- package/node_modules/pino/test/fixtures/transport-worker.js +15 -0
- package/node_modules/pino/test/fixtures/transport-wrong-export-type.js +3 -0
- package/node_modules/pino/test/fixtures/ts/to-file-transport-native.mts +15 -0
- package/node_modules/pino/test/fixtures/ts/to-file-transport-with-transform.ts +18 -0
- package/node_modules/pino/test/fixtures/ts/to-file-transport.ts +11 -0
- package/node_modules/pino/test/fixtures/ts/transpile.cjs +36 -0
- package/node_modules/pino/test/fixtures/ts/transport-exit-immediately-with-async-dest.ts +15 -0
- package/node_modules/pino/test/fixtures/ts/transport-exit-immediately.ts +10 -0
- package/node_modules/pino/test/fixtures/ts/transport-exit-on-ready.ts +11 -0
- package/node_modules/pino/test/fixtures/ts/transport-main.ts +8 -0
- package/node_modules/pino/test/fixtures/ts/transport-string-stdout.ts +8 -0
- package/node_modules/pino/test/fixtures/ts/transport-worker.ts +14 -0
- package/node_modules/pino/test/formatters.test.js +364 -0
- package/node_modules/pino/test/helper.d.ts +4 -0
- package/node_modules/pino/test/helper.js +159 -0
- package/node_modules/pino/test/hooks.test.js +114 -0
- package/node_modules/pino/test/http.test.js +214 -0
- package/node_modules/pino/test/internals/version.test.js +17 -0
- package/node_modules/pino/test/is-level-enabled.test.js +179 -0
- package/node_modules/pino/test/jest/basic.spec.js +10 -0
- package/node_modules/pino/test/levels.test.js +810 -0
- package/node_modules/pino/test/metadata.test.js +120 -0
- package/node_modules/pino/test/mixin-merge-strategy.test.js +57 -0
- package/node_modules/pino/test/mixin.test.js +241 -0
- package/node_modules/pino/test/multistream.test.js +793 -0
- package/node_modules/pino/test/redact.test.js +923 -0
- package/node_modules/pino/test/serializers.test.js +257 -0
- package/node_modules/pino/test/smoke.js +59 -0
- package/node_modules/pino/test/stdout-protection.test.js +41 -0
- package/node_modules/pino/test/syncfalse.test.js +186 -0
- package/node_modules/pino/test/timestamp-nano.test.js +37 -0
- package/node_modules/pino/test/timestamp.test.js +124 -0
- package/node_modules/pino/test/transport/big.test.js +42 -0
- package/node_modules/pino/test/transport/bundlers-support.test.js +99 -0
- package/node_modules/pino/test/transport/caller.test.js +24 -0
- package/node_modules/pino/test/transport/core.test.js +818 -0
- package/node_modules/pino/test/transport/core.transpiled.test.ts +114 -0
- package/node_modules/pino/test/transport/crash.test.js +36 -0
- package/node_modules/pino/test/transport/module-link.test.js +241 -0
- package/node_modules/pino/test/transport/native-type-stripping.test.mjs +151 -0
- package/node_modules/pino/test/transport/node-options.test.js +116 -0
- package/node_modules/pino/test/transport/pipeline.test.js +137 -0
- package/node_modules/pino/test/transport/preload.test.js +54 -0
- package/node_modules/pino/test/transport/repl.test.js +15 -0
- package/node_modules/pino/test/transport/sync-false.test.js +79 -0
- package/node_modules/pino/test/transport/sync-true.test.js +57 -0
- package/node_modules/pino/test/transport/targets.test.js +48 -0
- package/node_modules/pino/test/transport/uses-pino-config.test.js +166 -0
- package/node_modules/pino/test/transport-stream.test.js +40 -0
- package/node_modules/pino/test/types/pino-import.tst.cts +30 -0
- package/node_modules/pino/test/types/pino-import.tst.js +73 -0
- package/node_modules/pino/test/types/pino-multistream.tst.ts +49 -0
- package/node_modules/pino/test/types/pino-top-export.tst.ts +32 -0
- package/node_modules/pino/test/types/pino-transport.tst.ts +171 -0
- package/node_modules/pino/test/types/pino-type-only.tst.ts +77 -0
- package/node_modules/pino/test/types/pino.ts +98 -0
- package/node_modules/pino/test/types/pino.tst.ts +681 -0
- package/node_modules/pino/test/types/tsconfig.json +10 -0
- package/node_modules/pino/tsconfig.json +14 -0
- package/node_modules/pino-pretty/.borp.yaml +6 -0
- package/node_modules/pino-pretty/.editorconfig +13 -0
- package/node_modules/pino-pretty/.github/dependabot.yml +13 -0
- package/node_modules/pino-pretty/.github/workflows/ci.yml +83 -0
- package/node_modules/pino-pretty/LICENSE +21 -0
- package/node_modules/pino-pretty/Readme.md +425 -0
- package/node_modules/pino-pretty/SECURITY.md +146 -0
- package/node_modules/pino-pretty/benchmark.js +105 -0
- package/node_modules/pino-pretty/bin.js +113 -0
- package/node_modules/pino-pretty/demo.png +0 -0
- package/node_modules/pino-pretty/docs/help.md +24 -0
- package/node_modules/pino-pretty/eslint.config.js +5 -0
- package/node_modules/pino-pretty/help/help.txt +68 -0
- package/node_modules/pino-pretty/index.d.ts +227 -0
- package/node_modules/pino-pretty/index.js +234 -0
- package/node_modules/pino-pretty/lib/colors.js +134 -0
- package/node_modules/pino-pretty/lib/colors.test.js +132 -0
- package/node_modules/pino-pretty/lib/constants.js +55 -0
- package/node_modules/pino-pretty/lib/pretty.js +171 -0
- package/node_modules/pino-pretty/lib/utils/build-safe-sonic-boom.js +69 -0
- package/node_modules/pino-pretty/lib/utils/build-safe-sonic-boom.test.js +84 -0
- package/node_modules/pino-pretty/lib/utils/create-date.js +26 -0
- package/node_modules/pino-pretty/lib/utils/create-date.test.js +20 -0
- package/node_modules/pino-pretty/lib/utils/delete-log-property.js +28 -0
- package/node_modules/pino-pretty/lib/utils/delete-log-property.test.js +31 -0
- package/node_modules/pino-pretty/lib/utils/filter-log.js +99 -0
- package/node_modules/pino-pretty/lib/utils/filter-log.test.js +265 -0
- package/node_modules/pino-pretty/lib/utils/format-time.js +66 -0
- package/node_modules/pino-pretty/lib/utils/format-time.test.js +71 -0
- package/node_modules/pino-pretty/lib/utils/get-level-label-data.js +29 -0
- package/node_modules/pino-pretty/lib/utils/get-property-value.js +30 -0
- package/node_modules/pino-pretty/lib/utils/get-property-value.test.js +31 -0
- package/node_modules/pino-pretty/lib/utils/handle-custom-levels-names-opts.js +38 -0
- package/node_modules/pino-pretty/lib/utils/handle-custom-levels-names-opts.test.js +45 -0
- package/node_modules/pino-pretty/lib/utils/handle-custom-levels-opts.js +39 -0
- package/node_modules/pino-pretty/lib/utils/handle-custom-levels-opts.test.js +47 -0
- package/node_modules/pino-pretty/lib/utils/index.js +108 -0
- package/node_modules/pino-pretty/lib/utils/index.test.js +37 -0
- package/node_modules/pino-pretty/lib/utils/interpret-conditionals.js +41 -0
- package/node_modules/pino-pretty/lib/utils/interpret-conditionals.test.js +84 -0
- package/node_modules/pino-pretty/lib/utils/is-object.js +7 -0
- package/node_modules/pino-pretty/lib/utils/is-object.test.js +10 -0
- package/node_modules/pino-pretty/lib/utils/is-valid-date.js +14 -0
- package/node_modules/pino-pretty/lib/utils/is-valid-date.test.js +16 -0
- package/node_modules/pino-pretty/lib/utils/join-lines-with-indentation.js +29 -0
- package/node_modules/pino-pretty/lib/utils/join-lines-with-indentation.test.js +16 -0
- package/node_modules/pino-pretty/lib/utils/noop.js +3 -0
- package/node_modules/pino-pretty/lib/utils/noop.test.js +12 -0
- package/node_modules/pino-pretty/lib/utils/parse-factory-options.js +171 -0
- package/node_modules/pino-pretty/lib/utils/prettify-error-log.js +76 -0
- package/node_modules/pino-pretty/lib/utils/prettify-error-log.test.js +143 -0
- package/node_modules/pino-pretty/lib/utils/prettify-error.js +54 -0
- package/node_modules/pino-pretty/lib/utils/prettify-error.test.js +25 -0
- package/node_modules/pino-pretty/lib/utils/prettify-level.js +41 -0
- package/node_modules/pino-pretty/lib/utils/prettify-level.test.js +70 -0
- package/node_modules/pino-pretty/lib/utils/prettify-message.js +65 -0
- package/node_modules/pino-pretty/lib/utils/prettify-message.test.js +287 -0
- package/node_modules/pino-pretty/lib/utils/prettify-metadata.js +75 -0
- package/node_modules/pino-pretty/lib/utils/prettify-metadata.test.js +170 -0
- package/node_modules/pino-pretty/lib/utils/prettify-object.js +115 -0
- package/node_modules/pino-pretty/lib/utils/prettify-object.test.js +217 -0
- package/node_modules/pino-pretty/lib/utils/prettify-time.js +43 -0
- package/node_modules/pino-pretty/lib/utils/prettify-time.test.js +264 -0
- package/node_modules/pino-pretty/lib/utils/split-property-key.js +49 -0
- package/node_modules/pino-pretty/lib/utils/split-property-key.test.js +29 -0
- package/node_modules/pino-pretty/lib/utils/strip-unsafe-control-chars.js +18 -0
- package/node_modules/pino-pretty/lib/utils/strip-unsafe-control-chars.test.js +9 -0
- package/node_modules/pino-pretty/package.json +64 -0
- package/node_modules/pino-pretty/test/basic.test.js +1305 -0
- package/node_modules/pino-pretty/test/boolean-options.test.js +228 -0
- package/node_modules/pino-pretty/test/cli-rc.test.js +275 -0
- package/node_modules/pino-pretty/test/cli.test.js +360 -0
- package/node_modules/pino-pretty/test/crlf.test.js +33 -0
- package/node_modules/pino-pretty/test/error-objects.test.js +494 -0
- package/node_modules/pino-pretty/test/example/example.js +33 -0
- package/node_modules/pino-pretty/test/helper.js +19 -0
- package/node_modules/pino-pretty/test/types/exports.tst.ts +15 -0
- package/node_modules/pino-pretty/test/types/pino-pretty.tst.ts +140 -0
- package/node_modules/pino-pretty/test/types/tsconfig.json +9 -0
- package/package.json +12 -5
- package/lib/cli/commands/init.d.ts +0 -1
- package/lib/cli/commands/init.js +0 -8
- package/node_modules/@types/node/globals.global.d.ts +0 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Pino Ecosystem
|
|
2
|
+
|
|
3
|
+
This is a list of ecosystem modules that integrate with `pino`.
|
|
4
|
+
|
|
5
|
+
Modules listed under [Core](#core) are maintained by the Pino team. Modules
|
|
6
|
+
listed under [Community](#community) are maintained by independent community
|
|
7
|
+
members.
|
|
8
|
+
|
|
9
|
+
Please send a PR to add new modules!
|
|
10
|
+
|
|
11
|
+
<a id="core"></a>
|
|
12
|
+
## Core
|
|
13
|
+
|
|
14
|
+
### Frameworks
|
|
15
|
+
+ [`express-pino-logger`](https://github.com/pinojs/express-pino-logger): use
|
|
16
|
+
Pino to log requests within [express](https://expressjs.com/).
|
|
17
|
+
+ [`koa-pino-logger`](https://github.com/pinojs/koa-pino-logger): use Pino to
|
|
18
|
+
log requests within [Koa](https://koajs.com/).
|
|
19
|
+
+ [`restify-pino-logger`](https://github.com/pinojs/restify-pino-logger): use
|
|
20
|
+
Pino to log requests within [restify](http://restify.com/).
|
|
21
|
+
+ [`rill-pino-logger`](https://github.com/pinojs/rill-pino-logger): use Pino as
|
|
22
|
+
the logger for the [Rill framework](https://rill.site/).
|
|
23
|
+
|
|
24
|
+
### Utilities
|
|
25
|
+
+ [`pino-arborsculpture`](https://github.com/pinojs/pino-arborsculpture): change
|
|
26
|
+
log levels at runtime.
|
|
27
|
+
+ [`pino-caller`](https://github.com/pinojs/pino-caller): add callsite to the log line.
|
|
28
|
+
+ [`pino-clf`](https://github.com/pinojs/pino-clf): reformat Pino logs into
|
|
29
|
+
Common Log Format.
|
|
30
|
+
+ [`pino-console`](https://github.com/pinojs/pino-console): adapter for the [WHATWG Console](https://console.spec.whatwg.org/) spec.
|
|
31
|
+
+ [`pino-debug`](https://github.com/pinojs/pino-debug): use Pino to interpret
|
|
32
|
+
[`debug`](https://npm.im/debug) logs.
|
|
33
|
+
+ [`pino-elasticsearch`](https://github.com/pinojs/pino-elasticsearch): send
|
|
34
|
+
Pino logs to an Elasticsearch instance.
|
|
35
|
+
+ [`pino-eventhub`](https://github.com/pinojs/pino-eventhub): send Pino logs
|
|
36
|
+
to an [Event Hub](https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-what-is-event-hubs).
|
|
37
|
+
+ [`pino-filter`](https://github.com/pinojs/pino-filter): filter Pino logs in
|
|
38
|
+
the same fashion as the [`debug`](https://npm.im/debug) module.
|
|
39
|
+
+ [`pino-gelf`](https://github.com/pinojs/pino-gelf): reformat Pino logs into
|
|
40
|
+
GELF format for Graylog.
|
|
41
|
+
+ [`pino-hapi`](https://github.com/pinojs/hapi-pino): use Pino as the logger
|
|
42
|
+
for [Hapi](https://hapijs.com/).
|
|
43
|
+
+ [`pino-http`](https://github.com/pinojs/pino-http): easily use Pino to log
|
|
44
|
+
requests with the core `http` module.
|
|
45
|
+
+ [`pino-http-print`](https://github.com/pinojs/pino-http-print): reformat Pino
|
|
46
|
+
logs into traditional [HTTPD](https://httpd.apache.org/) style request logs.
|
|
47
|
+
+ [`pino-mongodb`](https://github.com/pinojs/pino-mongodb): store Pino logs
|
|
48
|
+
in a MongoDB database.
|
|
49
|
+
+ [`pino-multi-stream`](https://github.com/pinojs/pino-multi-stream): send
|
|
50
|
+
logs to multiple destination streams (slow!).
|
|
51
|
+
+ [`pino-noir`](https://github.com/pinojs/pino-noir): redact sensitive information
|
|
52
|
+
in logs.
|
|
53
|
+
+ [`pino-pretty`](https://github.com/pinojs/pino-pretty): basic prettifier to
|
|
54
|
+
make log lines human-readable.
|
|
55
|
+
+ [`pino-socket`](https://github.com/pinojs/pino-socket): send logs to TCP or UDP
|
|
56
|
+
destinations.
|
|
57
|
+
+ [`pino-std-serializers`](https://github.com/pinojs/pino-std-serializers): the
|
|
58
|
+
core object serializers used within Pino.
|
|
59
|
+
+ [`pino-syslog`](https://github.com/pinojs/pino-syslog): reformat Pino logs
|
|
60
|
+
to standard syslog format.
|
|
61
|
+
+ [`pino-tee`](https://github.com/pinojs/pino-tee): pipe Pino logs into files
|
|
62
|
+
based upon log levels.
|
|
63
|
+
+ [`pino-test`](https://github.com/pinojs/pino-test): a set of utilities for
|
|
64
|
+
verifying logs generated by the Pino logger.
|
|
65
|
+
+ [`pino-toke`](https://github.com/pinojs/pino-toke): reformat Pino logs
|
|
66
|
+
according to a given format string.
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
<a id="community"></a>
|
|
70
|
+
## Community
|
|
71
|
+
|
|
72
|
+
+ [`@google-cloud/pino-logging-gcp-config`](https://www.npmjs.com/package/@google-cloud/pino-logging-gcp-config): Config helper and formatter to output [Google Cloud Platform Structured Logging](https://cloud.google.com/logging/docs/structured-logging)
|
|
73
|
+
+ [`@newrelic/pino-enricher`](https://github.com/newrelic/newrelic-node-log-extensions/blob/main/packages/pino-log-enricher): a log customization to add New Relic context to use [Logs In Context](https://docs.newrelic.com/docs/logs/logs-context/logs-in-context/)
|
|
74
|
+
+ [`@sentry/node`](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/pino/): Sentry SDK with native pinoIntegration for direct Pino instrumentation and error tracking.
|
|
75
|
+
+ [`cloud-pine`](https://github.com/metcoder95/cloud-pine): transport that provides abstraction and compatibility with [`@google-cloud/logging`](https://www.npmjs.com/package/@google-cloud/logging).
|
|
76
|
+
+ [`cls-proxify`](https://github.com/keenondrums/cls-proxify): integration of pino and [CLS](https://github.com/jeff-lewis/cls-hooked). Useful for creating dynamically configured child loggers (e.g. with added trace ID) for each request.
|
|
77
|
+
+ [`crawlee-pino`](https://github.com/imyelo/crawlee-pino): use Pino to log within Crawlee
|
|
78
|
+
+ [`eslint-plugin-pino`](https://github.com/orzarchi/eslint-plugin-pino): linting rules for pino usage, primarly for preventing missing context in logs due to incorrect argument order.
|
|
79
|
+
+ [`pino-colada`](https://github.com/lrlna/pino-colada): cute ndjson formatter for pino.
|
|
80
|
+
+ [`pino-dev`](https://github.com/dnjstrom/pino-dev): simple prettifier for pino with built-in support for common ecosystem packages.
|
|
81
|
+
+ [`pino-fluentd`](https://github.com/davidedantonio/pino-fluentd): send Pino logs to Elasticsearch,
|
|
82
|
+
MongoDB, and many [others](https://www.fluentd.org/dataoutputs) via Fluentd.
|
|
83
|
+
+ [`pino-lambda`](https://github.com/FormidableLabs/pino-lambda): log transport for cloudwatch support inside aws-lambda
|
|
84
|
+
+ [`pino-pretty-min`](https://github.com/unjello/pino-pretty-min): a minimal
|
|
85
|
+
prettifier inspired by the [logrus](https://github.com/sirupsen/logrus) logger.
|
|
86
|
+
+ [`pino-rotating-file`](https://github.com/homeaway/pino-rotating-file): a hapi-pino log transport for splitting logs into separate, automatically rotating files.
|
|
87
|
+
+ [`pino-tiny`](https://github.com/holmok/pino-tiny): a tiny (and extensible?) little log formatter for pino.
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
# Help
|
|
2
|
+
|
|
3
|
+
* [Log rotation](#rotate)
|
|
4
|
+
* [Reopening log files](#reopening)
|
|
5
|
+
* [Saving to multiple files](#multiple)
|
|
6
|
+
* [Log filtering](#filter-logs)
|
|
7
|
+
* [Transports and systemd](#transport-systemd)
|
|
8
|
+
* [Log to different streams](#multi-stream)
|
|
9
|
+
* [Duplicate keys](#dupe-keys)
|
|
10
|
+
* [Log levels as labels instead of numbers](#level-string)
|
|
11
|
+
* [Pino with `debug`](#debug)
|
|
12
|
+
* [Unicode and Windows terminal](#windows)
|
|
13
|
+
* [Mapping Pino Log Levels to Google Cloud Logging (Stackdriver) Severity Levels](#stackdriver)
|
|
14
|
+
* [Using Grafana Loki to evaluate pino logs in a kubernetes cluster](#grafana-loki)
|
|
15
|
+
* [Avoid Message Conflict](#avoid-message-conflict)
|
|
16
|
+
* [Best performance for logging to `stdout`](#best-performance-for-stdout)
|
|
17
|
+
* [Testing](#testing)
|
|
18
|
+
|
|
19
|
+
<a id="rotate"></a>
|
|
20
|
+
## Log rotation
|
|
21
|
+
|
|
22
|
+
Use a separate tool for log rotation:
|
|
23
|
+
We recommend [logrotate](https://github.com/logrotate/logrotate).
|
|
24
|
+
Consider we output our logs to `/var/log/myapp.log` like so:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
$ node server.js > /var/log/myapp.log
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
We would rotate our log files with logrotate, by adding the following to `/etc/logrotate.d/myapp`:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
/var/log/myapp.log {
|
|
34
|
+
su root
|
|
35
|
+
daily
|
|
36
|
+
rotate 7
|
|
37
|
+
delaycompress
|
|
38
|
+
compress
|
|
39
|
+
notifempty
|
|
40
|
+
missingok
|
|
41
|
+
copytruncate
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The `copytruncate` configuration has a very slight possibility of lost log lines due
|
|
46
|
+
to a gap between copying and truncating - the truncate may occur after additional lines
|
|
47
|
+
have been written. To perform log rotation without `copytruncate`, see the [Reopening log files](#reopening)
|
|
48
|
+
help.
|
|
49
|
+
|
|
50
|
+
<a id="reopening"></a>
|
|
51
|
+
## Reopening log files
|
|
52
|
+
|
|
53
|
+
In cases where a log rotation tool doesn't offer copy-truncate capabilities,
|
|
54
|
+
or where using them is deemed inappropriate, `pino.destination`
|
|
55
|
+
can reopen file paths after a file has been moved away.
|
|
56
|
+
|
|
57
|
+
One way to use this is to set up a `SIGUSR2` or `SIGHUP` signal handler that
|
|
58
|
+
reopens the log file destination, making sure to write the process PID out
|
|
59
|
+
somewhere so the log rotation tool knows where to send the signal.
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
// write the process pid to a well known location for later
|
|
63
|
+
const fs = require('node:fs')
|
|
64
|
+
fs.writeFileSync('/var/run/myapp.pid', process.pid)
|
|
65
|
+
|
|
66
|
+
const dest = pino.destination('/log/file')
|
|
67
|
+
const logger = require('pino')(dest)
|
|
68
|
+
process.on('SIGHUP', () => dest.reopen())
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The log rotation tool can then be configured to send this signal to the process
|
|
72
|
+
after a log rotation event has occurred.
|
|
73
|
+
|
|
74
|
+
Given a similar scenario as in the [Log rotation](#rotate) section a basic
|
|
75
|
+
`logrotate` config that aligns with this strategy would look similar to the following:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
/var/log/myapp.log {
|
|
79
|
+
su root
|
|
80
|
+
daily
|
|
81
|
+
rotate 7
|
|
82
|
+
delaycompress
|
|
83
|
+
compress
|
|
84
|
+
notifempty
|
|
85
|
+
missingok
|
|
86
|
+
postrotate
|
|
87
|
+
kill -HUP `cat /var/run/myapp.pid`
|
|
88
|
+
endscript
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
<a id="multiple"></a>
|
|
93
|
+
## Saving to multiple files
|
|
94
|
+
|
|
95
|
+
See [`pino.multistream`](/docs/api.md#pino-multistream).
|
|
96
|
+
|
|
97
|
+
<a id="filter-logs"></a>
|
|
98
|
+
## Log Filtering
|
|
99
|
+
The Pino philosophy advocates common, preexisting, system utilities.
|
|
100
|
+
|
|
101
|
+
Some recommendations in line with this philosophy are:
|
|
102
|
+
|
|
103
|
+
1. Use [`grep`](https://linux.die.net/man/1/grep):
|
|
104
|
+
```sh
|
|
105
|
+
$ # View all "INFO" level logs
|
|
106
|
+
$ node app.js | grep '"level":30'
|
|
107
|
+
```
|
|
108
|
+
1. Use [`jq`](https://stedolan.github.io/jq/):
|
|
109
|
+
```sh
|
|
110
|
+
$ # View all "ERROR" level logs
|
|
111
|
+
$ node app.js | jq 'select(.level == 50)'
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
<a id="transport-systemd"></a>
|
|
115
|
+
## Transports and systemd
|
|
116
|
+
`systemd` makes it complicated to use pipes in services. One method for overcoming
|
|
117
|
+
this challenge is to use a subshell:
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
ExecStart=/bin/sh -c '/path/to/node app.js | pino-transport'
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
<a id="multi-stream"></a>
|
|
124
|
+
## Log to different streams
|
|
125
|
+
|
|
126
|
+
Pino's default log destination is the singular destination of `stdout`. While
|
|
127
|
+
not recommended for performance reasons, multiple destinations can be targeted
|
|
128
|
+
by using [`pino.multistream`](/docs/api.md#pino-multistream).
|
|
129
|
+
|
|
130
|
+
In this example, we use `stderr` for `error` level logs and `stdout` as default
|
|
131
|
+
for all other levels (e.g. `debug`, `info`, and `warn`).
|
|
132
|
+
|
|
133
|
+
```js
|
|
134
|
+
const pino = require('pino')
|
|
135
|
+
var streams = [
|
|
136
|
+
{level: 'debug', stream: process.stdout},
|
|
137
|
+
{level: 'error', stream: process.stderr},
|
|
138
|
+
{level: 'fatal', stream: process.stderr}
|
|
139
|
+
]
|
|
140
|
+
|
|
141
|
+
const logger = pino({
|
|
142
|
+
name: 'my-app',
|
|
143
|
+
level: 'debug', // must be the lowest level of all streams
|
|
144
|
+
}, pino.multistream(streams))
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
<a id="dupe-keys"></a>
|
|
148
|
+
## How Pino handles duplicate keys
|
|
149
|
+
|
|
150
|
+
Duplicate keys are possible when a logged object contains a top-level key that
|
|
151
|
+
collides with a Pino field or a key in the child logger's bindings, or when child
|
|
152
|
+
logger bindings collide with parent bindings.
|
|
153
|
+
|
|
154
|
+
For untrusted data, avoid passing externally supplied objects directly to logging
|
|
155
|
+
methods or child logger bindings. User-controlled top-level keys can conflict
|
|
156
|
+
with Pino fields such as `level`, `time`, or `msg`, as well as application or
|
|
157
|
+
security fields. If untrusted data must be logged, place it under an
|
|
158
|
+
application-controlled key, such as `logger.info({ untrusted })`, and prefer not
|
|
159
|
+
to log untrusted data at all unless necessary.
|
|
160
|
+
|
|
161
|
+
See the [child logger duplicate keys caveat](/docs/child-loggers.md#duplicate-keys-caveat)
|
|
162
|
+
and [`logger.child()` bindings](/docs/api.md#logger-child-bindings) for more information.
|
|
163
|
+
|
|
164
|
+
<a id="level-string"></a>
|
|
165
|
+
## Log levels as labels instead of numbers
|
|
166
|
+
Pino log lines are meant to be parsable. Thus, Pino's default mode of operation
|
|
167
|
+
is to print the level value instead of the string name.
|
|
168
|
+
However, you can use the [`formatters`](/docs/api.md#formatters-object) option
|
|
169
|
+
with a [`level`](/docs/api.md#level) function to print the string name instead of the level value :
|
|
170
|
+
|
|
171
|
+
```js
|
|
172
|
+
const pino = require('pino')
|
|
173
|
+
|
|
174
|
+
const log = pino({
|
|
175
|
+
formatters: {
|
|
176
|
+
level: (label) => {
|
|
177
|
+
return {
|
|
178
|
+
level: label
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
log.info('message')
|
|
185
|
+
|
|
186
|
+
// {"level":"info","time":1661632832200,"pid":18188,"hostname":"foo","msg":"message"}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Although it works, we recommend using one of these options instead if you are able:
|
|
190
|
+
|
|
191
|
+
1. If the only change desired is the name then a transport can be used. One such
|
|
192
|
+
transport is [`pino-text-level-transport`](https://npm.im/pino-text-level-transport).
|
|
193
|
+
1. Use a prettifier like [`pino-pretty`](https://npm.im/pino-pretty) to make
|
|
194
|
+
the logs human friendly.
|
|
195
|
+
|
|
196
|
+
<a id="debug"></a>
|
|
197
|
+
## Pino with `debug`
|
|
198
|
+
|
|
199
|
+
The popular [`debug`](https://npm.im/debug) is used in many modules across the ecosystem.
|
|
200
|
+
|
|
201
|
+
The [`pino-debug`](https://github.com/pinojs/pino-debug) module
|
|
202
|
+
can capture calls to `debug` loggers and run them
|
|
203
|
+
through `pino` instead. This results in a 10x (20x in asynchronous mode)
|
|
204
|
+
performance improvement - even though `pino-debug` is logging additional
|
|
205
|
+
data and wrapping it in JSON.
|
|
206
|
+
|
|
207
|
+
To quickly enable this install [`pino-debug`](https://github.com/pinojs/pino-debug)
|
|
208
|
+
and preload it with the `-r` flag, enabling any `debug` logs with the
|
|
209
|
+
`DEBUG` environment variable:
|
|
210
|
+
|
|
211
|
+
```sh
|
|
212
|
+
$ npm i pino-debug
|
|
213
|
+
$ DEBUG=* node -r pino-debug app.js
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
[`pino-debug`](https://github.com/pinojs/pino-debug) also offers fine-grain control to map specific `debug`
|
|
217
|
+
namespaces to `pino` log levels. See [`pino-debug`](https://github.com/pinojs/pino-debug)
|
|
218
|
+
for more.
|
|
219
|
+
|
|
220
|
+
<a id="windows"></a>
|
|
221
|
+
## Unicode and Windows terminal
|
|
222
|
+
|
|
223
|
+
Pino uses [sonic-boom](https://github.com/mcollina/sonic-boom) to speed
|
|
224
|
+
up logging. Internally, it uses [`fs.write`](https://nodejs.org/dist/latest-v10.x/docs/api/fs.html#fs_fs_write_fd_string_position_encoding_callback) to write log lines directly to a file
|
|
225
|
+
descriptor. On Windows, Unicode output is not handled properly in the
|
|
226
|
+
terminal (both `cmd.exe` and PowerShell), and as such the output could
|
|
227
|
+
be visualized incorrectly if the log lines include utf8 characters. It
|
|
228
|
+
is possible to configure the terminal to visualize those characters
|
|
229
|
+
correctly with the use of [`chcp`](https://ss64.com/nt/chcp.html) by
|
|
230
|
+
executing in the terminal `chcp 65001`. This is a known limitation of
|
|
231
|
+
Node.js.
|
|
232
|
+
|
|
233
|
+
<a id="stackdriver"></a>
|
|
234
|
+
## Mapping Pino Log Levels to Google Cloud Logging (Stackdriver) Severity Levels
|
|
235
|
+
|
|
236
|
+
Google Cloud Logging uses `severity` levels instead of log levels. As a result, all logs may show as INFO
|
|
237
|
+
level logs while completely ignoring the level set in the pino log. Google Cloud Logging also prefers that
|
|
238
|
+
log data is present inside a `message` key instead of the default `msg` key that Pino uses. Use a technique
|
|
239
|
+
similar to the one below to retain log levels in Google Cloud Logging
|
|
240
|
+
|
|
241
|
+
```js
|
|
242
|
+
const pino = require('pino')
|
|
243
|
+
|
|
244
|
+
// https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#logseverity
|
|
245
|
+
const PinoLevelToSeverityLookup = {
|
|
246
|
+
trace: 'DEBUG',
|
|
247
|
+
debug: 'DEBUG',
|
|
248
|
+
info: 'INFO',
|
|
249
|
+
warn: 'WARNING',
|
|
250
|
+
error: 'ERROR',
|
|
251
|
+
fatal: 'CRITICAL',
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
const defaultPinoConf = {
|
|
255
|
+
messageKey: 'message',
|
|
256
|
+
formatters: {
|
|
257
|
+
level(label, number) {
|
|
258
|
+
return {
|
|
259
|
+
severity: PinoLevelToSeverityLookup[label] || PinoLevelToSeverityLookup['info'],
|
|
260
|
+
level: number,
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
module.exports = function createLogger(options) {
|
|
267
|
+
return pino(Object.assign({}, options, defaultPinoConf))
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
A library that configures Pino for
|
|
272
|
+
[Google Cloud Structured Logging](https://cloud.google.com/logging/docs/structured-logging)
|
|
273
|
+
is available at:
|
|
274
|
+
[@google-cloud/pino-logging-gcp-config](https://www.npmjs.com/package/@google-cloud/pino-logging-gcp-config)
|
|
275
|
+
|
|
276
|
+
This library has the following features:
|
|
277
|
+
|
|
278
|
+
+ Converts Pino log levels to Google Cloud Logging log levels, as above
|
|
279
|
+
+ Uses `message` instead of `msg` for the message key, as above
|
|
280
|
+
+ Adds a millisecond-granularity timestamp in the
|
|
281
|
+
[structure](https://cloud.google.com/logging/docs/agent/logging/configuration#timestamp-processing)
|
|
282
|
+
recognised by Google Cloud Logging eg: \
|
|
283
|
+
`"timestamp":{"seconds":1445470140,"nanos":123000000}`
|
|
284
|
+
+ Adds a sequential
|
|
285
|
+
[`insertId`](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#FIELDS.insert_id)
|
|
286
|
+
to ensure log messages with identical timestamps are ordered correctly.
|
|
287
|
+
+ Logs including an `Error` object have the
|
|
288
|
+
[`stack_trace`](https://cloud.google.com/error-reporting/docs/formatting-error-messages#log-error)
|
|
289
|
+
property set so that the error is forwarded to Google Cloud Error Reporting.
|
|
290
|
+
+ Includes a
|
|
291
|
+
[`ServiceContext`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext)
|
|
292
|
+
object in the logs for Google Cloud Error Reporting, auto detected from the
|
|
293
|
+
environment if not specified
|
|
294
|
+
+ Maps the OpenTelemetry properties `span_id`, `trace_id`, and `trace_flags`
|
|
295
|
+
to the equivalent Google Cloud Logging fields.
|
|
296
|
+
|
|
297
|
+
<a id="grafana-loki"></a>
|
|
298
|
+
## Using Grafana Loki to evaluate pino logs in a kubernetes cluster
|
|
299
|
+
|
|
300
|
+
To get pino logs into Grafana Loki there are two options:
|
|
301
|
+
|
|
302
|
+
1. **Push:** Use [pino-loki](https://github.com/Julien-R44/pino-loki) to send logs directly to Loki.
|
|
303
|
+
1. **Pull:** Configure Grafana Promtail to read and properly parse the logs before sending them to Loki.
|
|
304
|
+
Similar to Google Cloud logging, this involves remapping the log levels. See this [article](https://medium.com/@janpaepke/structured-logging-in-the-grafana-monitoring-stack-8aff0a5af2f5) for details.
|
|
305
|
+
|
|
306
|
+
<a id="avoid-message-conflict"></a>
|
|
307
|
+
## Avoid Message Conflict
|
|
308
|
+
|
|
309
|
+
As described in the [`message` documentation](/docs/api.md#message), when a log
|
|
310
|
+
is written like `log.info({ msg: 'a message' }, 'another message')` then the
|
|
311
|
+
final output JSON will have `"msg":"another message"` and the `'a message'`
|
|
312
|
+
string will be lost. To overcome this, the [`logMethod` hook](/docs/api.md#logmethod)
|
|
313
|
+
can be used:
|
|
314
|
+
|
|
315
|
+
```js
|
|
316
|
+
'use strict'
|
|
317
|
+
|
|
318
|
+
const log = require('pino')({
|
|
319
|
+
level: 'debug',
|
|
320
|
+
hooks: {
|
|
321
|
+
logMethod (inputArgs, method) {
|
|
322
|
+
if (inputArgs.length === 2 && inputArgs[0].msg) {
|
|
323
|
+
inputArgs[0].originalMsg = inputArgs[0].msg
|
|
324
|
+
}
|
|
325
|
+
return method.apply(this, inputArgs)
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
})
|
|
329
|
+
|
|
330
|
+
log.info('no original message')
|
|
331
|
+
log.info({ msg: 'mapped to originalMsg' }, 'a message')
|
|
332
|
+
|
|
333
|
+
// {"level":30,"time":1596313323106,"pid":63739,"hostname":"foo","msg":"no original message"}
|
|
334
|
+
// {"level":30,"time":1596313323107,"pid":63739,"hostname":"foo","msg":"a message","originalMsg":"mapped to originalMsg"}
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
<a id="best-performance-for-stdout"></a>
|
|
338
|
+
## Best performance for logging to `stdout`
|
|
339
|
+
|
|
340
|
+
The best performance for logging directly to stdout is _usually_ achieved by using the
|
|
341
|
+
default configuration:
|
|
342
|
+
|
|
343
|
+
```js
|
|
344
|
+
const log = require('pino')();
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
You should only have to configure custom transports or other settings
|
|
348
|
+
if you have broader logging requirements.
|
|
349
|
+
|
|
350
|
+
<a id="testing"></a>
|
|
351
|
+
## Testing
|
|
352
|
+
|
|
353
|
+
See [`pino-test`](https://github.com/pinojs/pino-test).
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
## Long Term Support
|
|
2
|
+
|
|
3
|
+
Pino's Long Term Support (LTS) is provided according to the schedule laid
|
|
4
|
+
out in this document:
|
|
5
|
+
|
|
6
|
+
1. Major releases, "X" release of [semantic versioning][semver] X.Y.Z release
|
|
7
|
+
versions, are supported for a minimum period of six months from their release
|
|
8
|
+
date. The release date of any specific version can be found at
|
|
9
|
+
[https://github.com/pinojs/pino/releases](https://github.com/pinojs/pino/releases).
|
|
10
|
+
|
|
11
|
+
1. Major releases will receive security updates for an additional six months
|
|
12
|
+
from the release of the next major release. After this period
|
|
13
|
+
we will still review and release security fixes as long as they are
|
|
14
|
+
provided by the community and they do not violate other constraints,
|
|
15
|
+
e.g. minimum supported Node.js version.
|
|
16
|
+
|
|
17
|
+
1. Major releases will be tested and verified against all Node.js
|
|
18
|
+
release lines that are supported by the
|
|
19
|
+
[Node.js LTS policy](https://github.com/nodejs/Release) within the
|
|
20
|
+
LTS period of that given Pino release line. This implies that only
|
|
21
|
+
the latest Node.js release of a given line is supported.
|
|
22
|
+
|
|
23
|
+
A "month" is defined as 30 consecutive days.
|
|
24
|
+
|
|
25
|
+
> ## Security Releases and Semver
|
|
26
|
+
>
|
|
27
|
+
> As a consequence of providing long-term support for major releases, there
|
|
28
|
+
> are occasions where we need to release breaking changes as a _minor_
|
|
29
|
+
> version release. Such changes will _always_ be noted in the
|
|
30
|
+
> [release notes](https://github.com/pinojs/pino/releases).
|
|
31
|
+
>
|
|
32
|
+
> To avoid automatically receiving breaking security updates it is possible to use
|
|
33
|
+
> the tilde (`~`) range qualifier. For example, to get patches for the 6.1
|
|
34
|
+
> release, and avoid automatically updating to the 6.1 release, specify
|
|
35
|
+
> the dependency as `"pino": "~6.1.x"`. This will leave your application vulnerable,
|
|
36
|
+
> so please use with caution.
|
|
37
|
+
|
|
38
|
+
[semver]: https://semver.org/
|
|
39
|
+
|
|
40
|
+
<a name="supported-nodejs"></a>
|
|
41
|
+
|
|
42
|
+
### Supported Node.js versions
|
|
43
|
+
|
|
44
|
+
Pino follows the [Node.js release schedule][node-release]. A Pino release line
|
|
45
|
+
is tested against, and supports, every Node.js release line that is in its
|
|
46
|
+
_current_, _active LTS_, or _maintenance LTS_ phase when the Pino line is
|
|
47
|
+
released, as described above.
|
|
48
|
+
|
|
49
|
+
Support for a Node.js version is **only dropped in a new Pino major release**. A
|
|
50
|
+
published Pino major will never drop a Node.js release line that it originally
|
|
51
|
+
shipped with, so upgrading within a major line (for example, from `9.1.0` to
|
|
52
|
+
`9.4.0`) will never remove support for a Node.js version you already run on.
|
|
53
|
+
|
|
54
|
+
Once a Node.js release line reaches its end-of-life, Pino supports it on a
|
|
55
|
+
best-effort basis, with the following caveats:
|
|
56
|
+
|
|
57
|
+
- End-of-life Node.js versions are not exercised in continuous integration.
|
|
58
|
+
- Some fixes and features cannot be backported to the Pino lines that still
|
|
59
|
+
support them.
|
|
60
|
+
- Dependencies cannot be kept up to date.
|
|
61
|
+
|
|
62
|
+
To keep running on an end-of-life Node.js version, pin your dependency to the
|
|
63
|
+
last Pino major line that supported it. The [Schedule](#lts-schedule) below maps
|
|
64
|
+
each Pino release line to the Node.js versions it supports; for example, to stay
|
|
65
|
+
on Node.js 14, install the latest `8.x` release with `"pino": "8.x"`.
|
|
66
|
+
|
|
67
|
+
[node-release]: https://github.com/nodejs/release#release-schedule
|
|
68
|
+
|
|
69
|
+
<a name="lts-schedule"></a>
|
|
70
|
+
|
|
71
|
+
### Schedule
|
|
72
|
+
|
|
73
|
+
| Version | Release Date | End Of LTS Date | Node.js |
|
|
74
|
+
| :------ | :----------- | :-------------- | :------------------- |
|
|
75
|
+
| 9.x | 2024-04-26 | TBD | 18, 20, 22 |
|
|
76
|
+
| 8.x | 2022-06-01 | 2024-10-26 | 14, 16, 18, 20 |
|
|
77
|
+
| 7.x | 2021-10-14 | 2023-06-01 | 12, 14, 16 |
|
|
78
|
+
| 6.x | 2020-03-07 | 2022-04-14 | 10, 12, 14, 16 |
|
|
79
|
+
|
|
80
|
+
<a name="supported-os"></a>
|
|
81
|
+
|
|
82
|
+
### CI tested operating systems
|
|
83
|
+
|
|
84
|
+
Pino uses GitHub Actions for CI testing, please refer to
|
|
85
|
+
[GitHub's documentation regarding workflow runners](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources)
|
|
86
|
+
for further details on what the latest virtual environment is in relation to
|
|
87
|
+
the YAML workflow labels below:
|
|
88
|
+
|
|
89
|
+
| OS | YAML Workflow Label | Node.js |
|
|
90
|
+
|---------|------------------------|--------------|
|
|
91
|
+
| Linux | `ubuntu-latest` | 18, 20, 22 |
|
|
92
|
+
| Windows | `windows-latest` | 18, 20, 22 |
|
|
93
|
+
| MacOS | `macos-latest` | 18, 20, 22 |
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Pretty Printing
|
|
2
|
+
|
|
3
|
+
By default, Pino log lines are newline delimited JSON (NDJSON). This is perfect
|
|
4
|
+
for production usage and long-term storage. It's not so great for development
|
|
5
|
+
environments. Thus, Pino logs can be prettified by using a Pino prettifier
|
|
6
|
+
module like [`pino-pretty`][pp]:
|
|
7
|
+
|
|
8
|
+
1. Install a prettifier module as a separate dependency, e.g. `npm install pino-pretty`.
|
|
9
|
+
2. Instantiate the logger with the `transport.target` option set to `'pino-pretty'`:
|
|
10
|
+
```js
|
|
11
|
+
const pino = require('pino')
|
|
12
|
+
const logger = pino({
|
|
13
|
+
transport: {
|
|
14
|
+
target: 'pino-pretty'
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
logger.info('hi')
|
|
19
|
+
```
|
|
20
|
+
3. The transport option can also have an options object containing `pino-pretty` options:
|
|
21
|
+
```js
|
|
22
|
+
const pino = require('pino')
|
|
23
|
+
const logger = pino({
|
|
24
|
+
transport: {
|
|
25
|
+
target: 'pino-pretty',
|
|
26
|
+
options: {
|
|
27
|
+
colorize: true
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
logger.info('hi')
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Note:** `logger.flush()` does not flush the output of `pino-pretty`. See
|
|
36
|
+
[Flush Limitations with `pino-pretty`](/docs/asynchronous.md) for more details.
|
|
37
|
+
|
|
38
|
+
[pp]: https://github.com/pinojs/pino-pretty
|