@wbce/projen-d9 0.0.27 → 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 +185 -46
- package/API.md +153 -37
- package/CHANGELOG.md +20 -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/.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 +14 -7
- package/lib/cli/commands/init.d.ts +0 -1
- package/lib/cli/commands/init.js +0 -8
- package/lib/cli/commands/save/draft.js +0 -2
- package/node_modules/@types/node/globals.global.d.ts +0 -1
- /package/{lib/cli/commands/save/draft.d.ts → node_modules/pino/.nojekyll} +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: "github-actions"
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: "monthly"
|
|
7
|
+
open-pull-requests-limit: 10
|
|
8
|
+
|
|
9
|
+
- package-ecosystem: "npm"
|
|
10
|
+
directory: "/"
|
|
11
|
+
schedule:
|
|
12
|
+
interval: "monthly"
|
|
13
|
+
open-pull-requests-limit: 10
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
paths-ignore:
|
|
6
|
+
- 'docs/**'
|
|
7
|
+
- '*.md'
|
|
8
|
+
pull_request:
|
|
9
|
+
paths-ignore:
|
|
10
|
+
- 'docs/**'
|
|
11
|
+
- '*.md'
|
|
12
|
+
|
|
13
|
+
# This allows a subsequently queued workflow run to interrupt previous runs
|
|
14
|
+
concurrency:
|
|
15
|
+
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
|
|
16
|
+
cancel-in-progress: true
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
dependency-review:
|
|
20
|
+
name: Dependency Review
|
|
21
|
+
if: github.event_name == 'pull_request'
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
permissions:
|
|
24
|
+
contents: read
|
|
25
|
+
steps:
|
|
26
|
+
- name: Check out repo
|
|
27
|
+
uses: actions/checkout@v6
|
|
28
|
+
with:
|
|
29
|
+
persist-credentials: false
|
|
30
|
+
|
|
31
|
+
- name: Dependency review
|
|
32
|
+
uses: actions/dependency-review-action@v5
|
|
33
|
+
|
|
34
|
+
test:
|
|
35
|
+
name: Test
|
|
36
|
+
runs-on: ${{ matrix.os }}
|
|
37
|
+
permissions:
|
|
38
|
+
contents: read
|
|
39
|
+
strategy:
|
|
40
|
+
matrix:
|
|
41
|
+
node-version: [20, 22, 24]
|
|
42
|
+
os: [ubuntu-latest]
|
|
43
|
+
pino-version: [^10.0.0]
|
|
44
|
+
steps:
|
|
45
|
+
- name: Check out repo
|
|
46
|
+
uses: actions/checkout@v6
|
|
47
|
+
with:
|
|
48
|
+
persist-credentials: false
|
|
49
|
+
|
|
50
|
+
- name: Setup Node ${{ matrix.node-version }}
|
|
51
|
+
uses: actions/setup-node@v7
|
|
52
|
+
with:
|
|
53
|
+
node-version: ${{ matrix.node-version }}
|
|
54
|
+
|
|
55
|
+
- name: Restore cached dependencies
|
|
56
|
+
uses: actions/cache@v6
|
|
57
|
+
with:
|
|
58
|
+
path: node_modules
|
|
59
|
+
key: node-modules-${{ hashFiles('package.json') }}
|
|
60
|
+
|
|
61
|
+
- name: Install dependencies
|
|
62
|
+
run: npm i --ignore-scripts
|
|
63
|
+
|
|
64
|
+
- name: Install pino ${{ matrix.pino-version }}
|
|
65
|
+
run: npm i --no-save pino@${{ matrix.pino-version }}
|
|
66
|
+
|
|
67
|
+
- name: Run tests
|
|
68
|
+
run: npm run ci
|
|
69
|
+
|
|
70
|
+
automerge:
|
|
71
|
+
name: Automerge Dependabot PRs
|
|
72
|
+
if: >
|
|
73
|
+
github.event_name == 'pull_request' &&
|
|
74
|
+
github.event.pull_request.user.login == 'dependabot[bot]'
|
|
75
|
+
needs: test
|
|
76
|
+
permissions:
|
|
77
|
+
pull-requests: write
|
|
78
|
+
contents: write
|
|
79
|
+
runs-on: ubuntu-latest
|
|
80
|
+
steps:
|
|
81
|
+
- uses: fastify/github-action-merge-dependabot@v3
|
|
82
|
+
with:
|
|
83
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 the Pino team listed at https://github.com/pinojs/pino#the-team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
<a id="intro"></a>
|
|
2
|
+
# pino-pretty
|
|
3
|
+
|
|
4
|
+
[](https://www.npmjs.com/package/pino-pretty)
|
|
5
|
+
[](https://github.com/pinojs/pino-pretty/actions?query=workflow%3ACI)
|
|
6
|
+
[](https://coveralls.io/github/pinojs/pino-pretty?branch=master)
|
|
7
|
+
[](https://standardjs.com/)
|
|
8
|
+
|
|
9
|
+
This module provides a basic [ndjson](https://github.com/ndjson/ndjson-spec) formatter to be used in __development__. If an
|
|
10
|
+
incoming line looks like it could be a log line from an ndjson logger, in
|
|
11
|
+
particular the [Pino](https://getpino.io/) logging library, then it will apply
|
|
12
|
+
extra formatting by considering things like the log level and timestamp.
|
|
13
|
+
|
|
14
|
+
A standard Pino log line like:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
{"level":30,"time":1522431328992,"msg":"hello world","pid":42,"hostname":"foo","v":1}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Will format to:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
[17:35:28.992] INFO (42): hello world
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
If you landed on this page due to the deprecation of the `prettyPrint` option
|
|
27
|
+
of `pino`, read the [Programmatic Integration](#integration) section.
|
|
28
|
+
|
|
29
|
+
<a id="example"></a>
|
|
30
|
+
## Example
|
|
31
|
+
|
|
32
|
+
Using the [example script][exscript] from the Pino module, we can see what the
|
|
33
|
+
prettified logs will look like:
|
|
34
|
+
|
|
35
|
+

|
|
36
|
+
|
|
37
|
+
[exscript]: https://github.com/pinojs/pino/blob/25ba61f40ea5a1a753c85002812426d765da52a4/examples/basic.js
|
|
38
|
+
|
|
39
|
+
<a id="install"></a>
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
npm install -g pino-pretty
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
<a id="usage"></a>
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
It is recommended to use `pino-pretty` with `pino`
|
|
50
|
+
by piping output to the CLI tool:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
node app.js | pino-pretty
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
<a id="cliargs"></a>
|
|
57
|
+
### CLI Arguments
|
|
58
|
+
|
|
59
|
+
- `--colorize` (`-c`): Adds terminal color escape sequences to the output.
|
|
60
|
+
- `--no-colorizeObjects`: Suppress colorization of objects.
|
|
61
|
+
- `--crlf` (`-f`): Appends carriage return and line feed, instead of just a line
|
|
62
|
+
feed, to the formatted log line.
|
|
63
|
+
- `--errorProps` (`-e`): When formatting an error object, display this list
|
|
64
|
+
of properties. The list should be a comma-separated list of properties Default: `''`.
|
|
65
|
+
Do not use this option if logging from pino@7. Support will be removed from future versions.
|
|
66
|
+
- `--levelFirst` (`-l`): Display the log level name before the logged date and time.
|
|
67
|
+
- `--errorLikeObjectKeys` (`-k`): Define the log keys that are associated with
|
|
68
|
+
error like objects. Default: `err,error`.
|
|
69
|
+
- `--messageKey` (`-m`): Define the key that contains the main log message.
|
|
70
|
+
Default: `msg`.
|
|
71
|
+
- `--levelKey` (`--levelKey`): Define the key that contains the level of the log. Nested keys are supported with each property delimited by a dot character (`.`).
|
|
72
|
+
Keys may be escaped to target property names that contains the delimiter itself:
|
|
73
|
+
(`--levelKey tags\\.level`).
|
|
74
|
+
Default: `level`.
|
|
75
|
+
- `--levelLabel` (`-b`): Output the log level using the specified label.
|
|
76
|
+
Default: `levelLabel`.
|
|
77
|
+
- `--minimumLevel` (`-L`): Hide messages below the specified log level. Accepts a number, `trace`, `debug`, `info`, `warn`, `error`, or `fatal`. If any more filtering is required, consider using [`jq`](https://stedolan.github.io/jq/).
|
|
78
|
+
- `--customLevels` (`-x`): Override default levels with custom levels, e.g. `-x err:99,info:1`
|
|
79
|
+
- `--customColors` (`-X`): Override default colors with custom colors, e.g. `-X err:red,info:blue`
|
|
80
|
+
- `--useOnlyCustomProps` (`-U`): Only use custom levels and colors (if provided) (default: true); else fallback to default levels and colors, e.g. `-U false`
|
|
81
|
+
- `--messageFormat` (`-o`): Format output of message, e.g. `{levelLabel} - {pid} - url:{req.url}` will output message: `INFO - 1123 - url:localhost:3000/test`
|
|
82
|
+
Default: `false`
|
|
83
|
+
- `--timestampKey` (`-a`): Define the key that contains the log timestamp.
|
|
84
|
+
Default: `time`.
|
|
85
|
+
- `--translateTime` (`-t`): Translate the epoch time value into a human-readable
|
|
86
|
+
date and time string. This flag also can set the format string to apply when
|
|
87
|
+
translating the date to a human-readable format. For a list of available pattern
|
|
88
|
+
letters, see the [`dateformat` documentation](https://www.npmjs.com/package/dateformat).
|
|
89
|
+
- The default format is `HH:MM:ss.l` in the local timezone.
|
|
90
|
+
- Require a `UTC:` prefix to translate time to UTC, e.g. `UTC:yyyy-mm-dd HH:MM:ss.l o`.
|
|
91
|
+
- Require a `SYS:` prefix to translate time to the local system's time zone. A
|
|
92
|
+
shortcut `SYS:standard` to translate time to `yyyy-mm-dd HH:MM:ss.l o` in
|
|
93
|
+
system time zone.
|
|
94
|
+
- `--ignore` (`-i`): Ignore one or several keys, nested keys are supported with each property delimited by a dot character (`.`),
|
|
95
|
+
keys may be escaped to target property names that contains the delimiter itself:
|
|
96
|
+
(`-i time,hostname,req.headers,log\\.domain\\.corp/foo`).
|
|
97
|
+
The `--ignore` option would be ignored, if both `--ignore` and `--include` are passed.
|
|
98
|
+
Default: `hostname`.
|
|
99
|
+
- `--include` (`-I`): The opposite of `--ignore`. Include one or several keys, nested keys are supported with each property delimited by a dot character (`.`),
|
|
100
|
+
keys may be escaped to target property names that contains the delimiter itself:
|
|
101
|
+
(`-I time,hostname,req.headers,log\.domain\.corp/foo`).
|
|
102
|
+
- `--hideObject` (`-H`): Hide objects from output (but not error object)
|
|
103
|
+
- `--singleLine` (`-S`): Print each log message on a single line (errors will still be multi-line)
|
|
104
|
+
- `--config`: Specify a path to a config file containing the pino-pretty options. pino-pretty will attempt to read from a `.pino-prettyrc` in your current directory (`process.cwd`) if not specified
|
|
105
|
+
|
|
106
|
+
<a id="integration"></a>
|
|
107
|
+
## Programmatic Integration
|
|
108
|
+
|
|
109
|
+
We recommend against using `pino-pretty` in production and highly
|
|
110
|
+
recommend installing `pino-pretty` as a development dependency.
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npm install --save-dev pino-pretty
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Install `pino-pretty` alongside `pino` and set the transport target to `'pino-pretty'`:
|
|
117
|
+
|
|
118
|
+
```js
|
|
119
|
+
const pino = require('pino')
|
|
120
|
+
const logger = pino({
|
|
121
|
+
transport: {
|
|
122
|
+
target: 'pino-pretty'
|
|
123
|
+
},
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
logger.info('hi')
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The transport option can also have an options object containing `pino-pretty` options:
|
|
130
|
+
|
|
131
|
+
```js
|
|
132
|
+
const pino = require('pino')
|
|
133
|
+
const logger = pino({
|
|
134
|
+
transport: {
|
|
135
|
+
target: 'pino-pretty',
|
|
136
|
+
options: {
|
|
137
|
+
colorize: true
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
logger.info('hi')
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Use it as a stream:
|
|
146
|
+
|
|
147
|
+
```js
|
|
148
|
+
const pino = require('pino')
|
|
149
|
+
const pretty = require('pino-pretty')
|
|
150
|
+
const logger = pino(pretty())
|
|
151
|
+
|
|
152
|
+
logger.info('hi')
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Options are also supported:
|
|
156
|
+
|
|
157
|
+
```js
|
|
158
|
+
const pino = require('pino')
|
|
159
|
+
const pretty = require('pino-pretty')
|
|
160
|
+
const stream = pretty({
|
|
161
|
+
colorize: true
|
|
162
|
+
})
|
|
163
|
+
const logger = pino(stream)
|
|
164
|
+
|
|
165
|
+
logger.info('hi')
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
See the [Options](#options) section for all possible options.
|
|
169
|
+
|
|
170
|
+
The following configuration ensures that `pino-pretty` is activated only in development mode.
|
|
171
|
+
|
|
172
|
+
```js
|
|
173
|
+
const pino = require('pino')
|
|
174
|
+
|
|
175
|
+
// Define the transport configuration only when the output stream is connected to a TTY
|
|
176
|
+
const transport =
|
|
177
|
+
process.stdout.isTTY
|
|
178
|
+
? { transport: { target: 'pino-pretty' } }
|
|
179
|
+
: {};
|
|
180
|
+
|
|
181
|
+
const logger = pino({
|
|
182
|
+
...transport
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
logger.info('hi')
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Usage as a stream
|
|
189
|
+
|
|
190
|
+
If you are using `pino-pretty` as a stream and you need to provide options to `pino`,
|
|
191
|
+
pass the options as the first argument and `pino-pretty` as second argument:
|
|
192
|
+
|
|
193
|
+
```js
|
|
194
|
+
const pino = require('pino')
|
|
195
|
+
const pretty = require('pino-pretty')
|
|
196
|
+
const stream = pretty({
|
|
197
|
+
colorize: true
|
|
198
|
+
})
|
|
199
|
+
const logger = pino({ level: 'info' }, stream)
|
|
200
|
+
|
|
201
|
+
// Nothing is printed
|
|
202
|
+
logger.debug('hi')
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Usage with Jest
|
|
206
|
+
|
|
207
|
+
Logging with Jest is _problematic_, as the test framework requires no asynchronous operation to
|
|
208
|
+
continue after the test has finished. The following is the only supported way to use this module
|
|
209
|
+
with Jest:
|
|
210
|
+
|
|
211
|
+
```js
|
|
212
|
+
import pino from 'pino'
|
|
213
|
+
import pretty from 'pino-pretty'
|
|
214
|
+
|
|
215
|
+
test('test pino-pretty', () => {
|
|
216
|
+
const logger = pino(pretty({ sync: true }));
|
|
217
|
+
logger.info('Info');
|
|
218
|
+
logger.error('Error');
|
|
219
|
+
});
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Handling non-serializable options
|
|
223
|
+
|
|
224
|
+
Using the new [pino v7+
|
|
225
|
+
transports](https://getpino.io/#/docs/transports?id=v7-transports) not all
|
|
226
|
+
options are serializable, for example if you want to use `messageFormat` as a
|
|
227
|
+
function you will need to wrap `pino-pretty` in a custom module.
|
|
228
|
+
|
|
229
|
+
Executing `main.js` below will log a colorized `hello world` message using a
|
|
230
|
+
custom function `messageFormat`:
|
|
231
|
+
|
|
232
|
+
```js
|
|
233
|
+
// main.js
|
|
234
|
+
const pino = require('pino')
|
|
235
|
+
|
|
236
|
+
const logger = pino({
|
|
237
|
+
transport: {
|
|
238
|
+
target: './pino-pretty-transport',
|
|
239
|
+
options: {
|
|
240
|
+
colorize: true
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
})
|
|
244
|
+
|
|
245
|
+
logger.info('world')
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
```js
|
|
249
|
+
// pino-pretty-transport.js
|
|
250
|
+
module.exports = opts => require('pino-pretty')({
|
|
251
|
+
...opts,
|
|
252
|
+
messageFormat: (log, messageKey) => `hello ${log[messageKey]}`
|
|
253
|
+
})
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Checking color support in TTY
|
|
257
|
+
|
|
258
|
+
This boolean returns whether the currently used TTY supports colorizing the logs.
|
|
259
|
+
|
|
260
|
+
```js
|
|
261
|
+
import pretty from 'pino-pretty'
|
|
262
|
+
|
|
263
|
+
if (pretty.isColorSupported) {
|
|
264
|
+
...
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
<a id="options"></a>
|
|
270
|
+
### Options
|
|
271
|
+
|
|
272
|
+
The options accepted have keys corresponding to the options described in [CLI Arguments](#cliargs):
|
|
273
|
+
|
|
274
|
+
```js
|
|
275
|
+
{
|
|
276
|
+
colorize: colorette.isColorSupported, // --colorize
|
|
277
|
+
colorizeObjects: true, //--colorizeObjects
|
|
278
|
+
crlf: false, // --crlf
|
|
279
|
+
errorLikeObjectKeys: ['err', 'error'], // --errorLikeObjectKeys (not required to match custom errorKey with pino >=8.21.0)
|
|
280
|
+
errorProps: '', // --errorProps
|
|
281
|
+
levelFirst: false, // --levelFirst
|
|
282
|
+
messageKey: 'msg', // --messageKey (not required with pino >=8.21.0)
|
|
283
|
+
levelKey: 'level', // --levelKey
|
|
284
|
+
messageFormat: false, // --messageFormat
|
|
285
|
+
timestampKey: 'time', // --timestampKey
|
|
286
|
+
translateTime: false, // --translateTime
|
|
287
|
+
ignore: 'pid,hostname', // --ignore
|
|
288
|
+
include: 'level,time', // --include
|
|
289
|
+
hideObject: false, // --hideObject
|
|
290
|
+
singleLine: false, // --singleLine
|
|
291
|
+
customColors: 'err:red,info:blue', // --customColors
|
|
292
|
+
customLevels: 'err:99,info:1', // --customLevels (not required with pino >=8.21.0)
|
|
293
|
+
levelLabel: 'levelLabel', // --levelLabel
|
|
294
|
+
minimumLevel: 'info', // --minimumLevel
|
|
295
|
+
useOnlyCustomProps: true, // --useOnlyCustomProps
|
|
296
|
+
// The file or file descriptor (1 is stdout) to write to
|
|
297
|
+
destination: 1,
|
|
298
|
+
|
|
299
|
+
// Alternatively, pass a `sonic-boom` instance (allowing more flexibility):
|
|
300
|
+
// destination: new SonicBoom({ dest: 'a/file', mkdir: true })
|
|
301
|
+
|
|
302
|
+
// You can also configure some SonicBoom options directly
|
|
303
|
+
sync: false, // by default we write asynchronously
|
|
304
|
+
append: true, // the file is opened with the 'a' flag
|
|
305
|
+
mkdir: true, // create the target destination
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
customPrettifiers: {}
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
The `colorize` default follows
|
|
313
|
+
[`colorette.isColorSupported`](https://github.com/jorgebucaran/colorette#iscolorsupported).
|
|
314
|
+
|
|
315
|
+
The defaults for `sync`, `append`, `mkdir` inherit from
|
|
316
|
+
[`SonicBoom(opts)`](https://github.com/pinojs/sonic-boom#API).
|
|
317
|
+
|
|
318
|
+
`customPrettifiers` option provides the ability to add a custom prettify function
|
|
319
|
+
for specific log properties. `customPrettifiers` is an object, where keys are
|
|
320
|
+
log properties that will be prettified and value is the prettify function itself.
|
|
321
|
+
For example, if a log line contains a `query` property,
|
|
322
|
+
you can specify a prettifier for it:
|
|
323
|
+
|
|
324
|
+
```js
|
|
325
|
+
{
|
|
326
|
+
customPrettifiers: {
|
|
327
|
+
query: prettifyQuery
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
//...
|
|
331
|
+
const prettifyQuery = value => {
|
|
332
|
+
// do some prettify magic
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
All prettifiers use this function signature:
|
|
337
|
+
|
|
338
|
+
```js
|
|
339
|
+
['logObjKey']: (output, keyName, logObj, extras) => string
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
* `logObjKey` - name of the key of the property in the log object that should have this function applied to it
|
|
343
|
+
* `output` - the value of the property in the log object
|
|
344
|
+
* `keyName` - the name of the property (useful for `level` and `message` when `levelKey` or `messageKey` is used)
|
|
345
|
+
* `logObj` - the full log object, for context
|
|
346
|
+
* `extras` - an object containing **additional** data/functions created in the context of this pino-pretty logger or specific to the key (see `level` prettifying below)
|
|
347
|
+
* All `extras` objects contain `colors` which is a [Colorette](https://github.com/jorgebucaran/colorette?tab=readme-ov-file#supported-colors) object containing color functions. Colors are enabled based on `colorize` provided to pino-pretty or `colorette.isColorSupported` if `colorize` was not provided.
|
|
348
|
+
|
|
349
|
+
Additionally, `customPrettifiers` can be used to format the `time`, `hostname`,
|
|
350
|
+
`pid`, `name`, `caller` and `level` outputs AS WELL AS any arbitrary key-value that exists on a given log object.
|
|
351
|
+
|
|
352
|
+
An example usage of `customPrettifiers` using all parameters from the function signature:
|
|
353
|
+
|
|
354
|
+
```js
|
|
355
|
+
{
|
|
356
|
+
customPrettifiers: {
|
|
357
|
+
// The argument for this function will be the same
|
|
358
|
+
// string that's at the start of the log-line by default:
|
|
359
|
+
time: timestamp => `🕰 ${timestamp}`,
|
|
360
|
+
|
|
361
|
+
// The argument for the level-prettifier may vary depending
|
|
362
|
+
// on if the levelKey option is used or not.
|
|
363
|
+
// By default this will be the same numerics as the Pino default:
|
|
364
|
+
level: logLevel => `LEVEL: ${logLevel}`,
|
|
365
|
+
// level provides additional data in `extras`:
|
|
366
|
+
// * label => derived level label string
|
|
367
|
+
// * labelColorized => derived level label string with colorette colors applied based on customColors and whether colors are supported
|
|
368
|
+
level: (logLevel, key, log, { label, labelColorized, colors }) => `LEVEL: ${logLevel} LABEL: ${levelLabel} COLORIZED LABEL: ${labelColorized}`,
|
|
369
|
+
|
|
370
|
+
// other prettifiers can be used for the other keys if needed, for example
|
|
371
|
+
hostname: hostname => `MY HOST: ${hostname}`,
|
|
372
|
+
pid: pid => pid,
|
|
373
|
+
name: (name, key, log, { colors }) => `${colors.blue(name)}`,
|
|
374
|
+
caller: (caller, key, log, { colors }) => `${colors.greenBright(caller)}`,
|
|
375
|
+
myCustomLogProp: (value, key, log, { colors }) => `My Prop -> ${colors.bold(value)} <--`
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
`messageFormat` option allows you to customize the message output.
|
|
381
|
+
A template `string` like this can define the format:
|
|
382
|
+
|
|
383
|
+
```js
|
|
384
|
+
{
|
|
385
|
+
messageFormat: '{levelLabel} - {pid} - url:{req.url}'
|
|
386
|
+
}
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
In addition to this, if / end statement blocks can also be specified.
|
|
390
|
+
Else statements and nested conditions are not supported.
|
|
391
|
+
|
|
392
|
+
```js
|
|
393
|
+
{
|
|
394
|
+
messageFormat: '{levelLabel} - {if pid}{pid} - {end}url:{req.url}'
|
|
395
|
+
}
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
This option can also be defined as a `function` with this function signature:
|
|
399
|
+
|
|
400
|
+
```js
|
|
401
|
+
{
|
|
402
|
+
messageFormat: (log, messageKey, levelLabel, { colors }) => {
|
|
403
|
+
// do some log message customization
|
|
404
|
+
//
|
|
405
|
+
// `colors` is a Colorette object with colors enabled based on `colorize` option
|
|
406
|
+
return `This is a ${colors.red('colorized')}, custom message: ${log[messageKey]}`;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
## Limitations
|
|
412
|
+
|
|
413
|
+
Because `pino-pretty` uses stdout redirection, in some cases the command may
|
|
414
|
+
terminate with an error due to shell limitations.
|
|
415
|
+
|
|
416
|
+
For example, currently, mingw64 based shells (e.g. Bash as supplied by [git for
|
|
417
|
+
Windows](https://gitforwindows.org)) are affected and terminate the process with
|
|
418
|
+
a `stdout is not a tty` error message.
|
|
419
|
+
|
|
420
|
+
Any PRs are welcomed!
|
|
421
|
+
|
|
422
|
+
<a id="license"></a>
|
|
423
|
+
## License
|
|
424
|
+
|
|
425
|
+
MIT License
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
This document describes the management of vulnerabilities for the
|
|
4
|
+
pino-pretty project and defines its threat model.
|
|
5
|
+
|
|
6
|
+
pino-pretty is a development-time formatter for Pino and NDJSON log records.
|
|
7
|
+
It is not intended to provide a security boundary or to process adversarial
|
|
8
|
+
production log streams.
|
|
9
|
+
|
|
10
|
+
## Reporting vulnerabilities
|
|
11
|
+
|
|
12
|
+
Individuals who find potential vulnerabilities in pino-pretty are invited
|
|
13
|
+
to report them via email at matteo.collina@gmail.com.
|
|
14
|
+
|
|
15
|
+
For issues that are not security-sensitive, please open a pull request
|
|
16
|
+
that fixes the issue instead of submitting a vulnerability report.
|
|
17
|
+
|
|
18
|
+
## Threat model
|
|
19
|
+
|
|
20
|
+
### Intended use and assumptions
|
|
21
|
+
|
|
22
|
+
pino-pretty is expected to run as a normal, non-privileged process in a local
|
|
23
|
+
development environment. The following inputs are trusted:
|
|
24
|
+
|
|
25
|
+
* The local machine and source checkout
|
|
26
|
+
* Configuration files and the current working directory
|
|
27
|
+
* Command-line arguments and programmatic options
|
|
28
|
+
* `messageFormat` functions and custom prettifiers
|
|
29
|
+
* Output destinations
|
|
30
|
+
* Installed dependencies
|
|
31
|
+
|
|
32
|
+
Configuration files and custom callbacks are executable code and are not
|
|
33
|
+
sandboxed.
|
|
34
|
+
|
|
35
|
+
### Potentially untrusted input
|
|
36
|
+
|
|
37
|
+
Log record contents may contain malformed or unexpected values, including
|
|
38
|
+
values derived from HTTP requests or other external input handled by the
|
|
39
|
+
application under development.
|
|
40
|
+
|
|
41
|
+
### Security requirements
|
|
42
|
+
|
|
43
|
+
Malformed or externally influenced log content must not:
|
|
44
|
+
|
|
45
|
+
* Cause JavaScript code or shell commands to execute
|
|
46
|
+
* Select or load configuration modules
|
|
47
|
+
* Choose an output destination or access arbitrary files
|
|
48
|
+
* Pollute object prototypes through parsed JSON
|
|
49
|
+
|
|
50
|
+
These requirements apply to log record contents, not to trusted configuration
|
|
51
|
+
or custom callbacks. Those are executable code and may perform these actions
|
|
52
|
+
by design; callers are responsible for reviewing them.
|
|
53
|
+
|
|
54
|
+
### Accepted limitations
|
|
55
|
+
|
|
56
|
+
Within the intended development use, the following are accepted limitations,
|
|
57
|
+
not vulnerabilities under this policy by themselves:
|
|
58
|
+
|
|
59
|
+
* Control characters or embedded newlines may distort terminal output
|
|
60
|
+
* Very large or deeply nested records may slow or terminate the formatter
|
|
61
|
+
* Sensitive values already present in logs may be displayed
|
|
62
|
+
* Formatting failures may interrupt the developer's logging workflow
|
|
63
|
+
|
|
64
|
+
These limitations primarily affect the local developer process. A report is
|
|
65
|
+
warranted if one of them enables a violation of the security requirements
|
|
66
|
+
above.
|
|
67
|
+
|
|
68
|
+
### Out of scope
|
|
69
|
+
|
|
70
|
+
pino-pretty does not provide:
|
|
71
|
+
|
|
72
|
+
* Secret redaction
|
|
73
|
+
* Log authenticity or tamper resistance
|
|
74
|
+
* Availability guarantees under adversarial load
|
|
75
|
+
* Sandboxing for configuration or custom functions
|
|
76
|
+
* Secure log storage or access control
|
|
77
|
+
* Isolation suitable for multi-tenant or hostile production logs
|
|
78
|
+
|
|
79
|
+
Redaction, input limits, process isolation, and secure storage must be
|
|
80
|
+
implemented upstream when required.
|
|
81
|
+
|
|
82
|
+
### Use outside the intended scope
|
|
83
|
+
|
|
84
|
+
Using pino-pretty with production, remote, or multi-tenant logs, or running it
|
|
85
|
+
inside an untrusted checkout, invalidates the assumptions above. Such use may
|
|
86
|
+
require terminal-control sanitization, resource limits, process isolation, and
|
|
87
|
+
disabling executable configuration discovery.
|
|
88
|
+
|
|
89
|
+
## Handling vulnerability reports
|
|
90
|
+
|
|
91
|
+
When a potential vulnerability is reported, the following actions are taken:
|
|
92
|
+
|
|
93
|
+
### Triage
|
|
94
|
+
|
|
95
|
+
**Delay:** 5 business days
|
|
96
|
+
|
|
97
|
+
Within 5 business days, a member of the security team provides a first answer
|
|
98
|
+
to the individual who submitted the potential vulnerability. The possible
|
|
99
|
+
responses are:
|
|
100
|
+
|
|
101
|
+
* Acceptance: what was reported is considered a new vulnerability
|
|
102
|
+
* Rejection: what was reported is not considered a vulnerability
|
|
103
|
+
* Need more information: the security team needs more information to evaluate
|
|
104
|
+
what was reported
|
|
105
|
+
|
|
106
|
+
Triaging should include updating issue fields:
|
|
107
|
+
|
|
108
|
+
* Asset - set or create the module affected by the report
|
|
109
|
+
* Severity - TBD, currently left empty
|
|
110
|
+
|
|
111
|
+
### Correction follow-up
|
|
112
|
+
|
|
113
|
+
**Delay:** 90 days
|
|
114
|
+
|
|
115
|
+
When a vulnerability is confirmed, a member of the security team volunteers
|
|
116
|
+
to follow up on the report.
|
|
117
|
+
|
|
118
|
+
With the help of the individual who reported the vulnerability, they contact
|
|
119
|
+
the maintainers of the vulnerable package to make them aware of the
|
|
120
|
+
vulnerability. The maintainers can be invited as participants in the reported
|
|
121
|
+
issue.
|
|
122
|
+
|
|
123
|
+
With the package maintainer, they define a release date for publication of the
|
|
124
|
+
vulnerability. Ideally, publication should not happen before the package has
|
|
125
|
+
been patched.
|
|
126
|
+
|
|
127
|
+
The report's vulnerable versions upper limit should be set to:
|
|
128
|
+
|
|
129
|
+
* `*` if there is no fixed version available by the time of publishing the
|
|
130
|
+
report
|
|
131
|
+
* The last vulnerable version, for example `<=1.2.3` if a fix exists in `1.2.4`
|
|
132
|
+
|
|
133
|
+
### Publication
|
|
134
|
+
|
|
135
|
+
**Delay:** 90 days
|
|
136
|
+
|
|
137
|
+
Within 90 days after the triage date, the vulnerability must be made public.
|
|
138
|
+
|
|
139
|
+
**Severity:** Vulnerability severity is assessed using
|
|
140
|
+
[CVSS v.3](https://www.first.org/cvss/user-guide).
|
|
141
|
+
|
|
142
|
+
If the package maintainer is actively developing a patch, an additional delay
|
|
143
|
+
can be added with the approval of the security team and the individual who
|
|
144
|
+
reported the vulnerability.
|
|
145
|
+
|
|
146
|
+
At this point, a CVE will be requested by the team.
|