@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,306 @@
|
|
|
1
|
+
# Web Frameworks
|
|
2
|
+
|
|
3
|
+
Since HTTP logging is a primary use case, Pino has first-class support for the Node.js
|
|
4
|
+
web framework ecosystem.
|
|
5
|
+
|
|
6
|
+
- [Web Frameworks](#web-frameworks)
|
|
7
|
+
- [Pino with Fastify](#pino-with-fastify)
|
|
8
|
+
- [Pino with Express](#pino-with-express)
|
|
9
|
+
- [Pino with Hapi](#pino-with-hapi)
|
|
10
|
+
- [Pino with Restify](#pino-with-restify)
|
|
11
|
+
- [Pino with Koa](#pino-with-koa)
|
|
12
|
+
- [Pino with Node core `http`](#pino-with-node-core-http)
|
|
13
|
+
- [Pino with Nest](#pino-with-nest)
|
|
14
|
+
- [Pino with H3](#pino-with-h3)
|
|
15
|
+
- [Pino with Hono](#pino-with-hono)
|
|
16
|
+
|
|
17
|
+
<a id="fastify"></a>
|
|
18
|
+
## Pino with Fastify
|
|
19
|
+
|
|
20
|
+
The Fastify web framework comes bundled with Pino by default, simply set Fastify's
|
|
21
|
+
`logger` option to `true` and use `request.log` or `reply.log` for log messages that correspond
|
|
22
|
+
to each request:
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
const fastify = require('fastify')({
|
|
26
|
+
logger: true
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
fastify.get('/', async (request, reply) => {
|
|
30
|
+
request.log.info('something')
|
|
31
|
+
return { hello: 'world' }
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
fastify.listen({ port: 3000 }, (err) => {
|
|
35
|
+
if (err) {
|
|
36
|
+
fastify.log.error(err)
|
|
37
|
+
process.exit(1)
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The `logger` option can also be set to an object, which will be passed through directly
|
|
43
|
+
as the [`pino` options object](/docs/api.md#options-object).
|
|
44
|
+
|
|
45
|
+
See the [fastify documentation](https://www.fastify.io/docs/latest/Reference/Logging/) for more information.
|
|
46
|
+
|
|
47
|
+
<a id="express"></a>
|
|
48
|
+
## Pino with Express
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
npm install pino-http
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
const app = require('express')()
|
|
56
|
+
const pino = require('pino-http')()
|
|
57
|
+
|
|
58
|
+
app.use(pino)
|
|
59
|
+
|
|
60
|
+
app.get('/', function (req, res) {
|
|
61
|
+
req.log.info('something')
|
|
62
|
+
res.send('hello world')
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
app.listen(3000)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
See the [pino-http README](https://npm.im/pino-http) for more info.
|
|
69
|
+
|
|
70
|
+
<a id="hapi"></a>
|
|
71
|
+
## Pino with Hapi
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
npm install hapi-pino
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```js
|
|
78
|
+
'use strict'
|
|
79
|
+
|
|
80
|
+
const Hapi = require('@hapi/hapi')
|
|
81
|
+
const Pino = require('hapi-pino');
|
|
82
|
+
|
|
83
|
+
async function start () {
|
|
84
|
+
// Create a server with a host and port
|
|
85
|
+
const server = Hapi.server({
|
|
86
|
+
host: 'localhost',
|
|
87
|
+
port: 3000
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
// Add the route
|
|
91
|
+
server.route({
|
|
92
|
+
method: 'GET',
|
|
93
|
+
path: '/',
|
|
94
|
+
handler: async function (request, h) {
|
|
95
|
+
// request.log is HAPI's standard way of logging
|
|
96
|
+
request.log(['a', 'b'], 'Request into hello world')
|
|
97
|
+
|
|
98
|
+
// a pino instance can also be used, which will be faster
|
|
99
|
+
request.logger.info('In handler %s', request.path)
|
|
100
|
+
|
|
101
|
+
return 'hello world'
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
await server.register(Pino)
|
|
106
|
+
|
|
107
|
+
// also as a decorated API
|
|
108
|
+
server.logger.info('another way for accessing it')
|
|
109
|
+
|
|
110
|
+
// and through Hapi standard logging system
|
|
111
|
+
server.log(['subsystem'], 'third way for accessing it')
|
|
112
|
+
|
|
113
|
+
await server.start()
|
|
114
|
+
|
|
115
|
+
return server
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
start().catch((err) => {
|
|
119
|
+
console.log(err)
|
|
120
|
+
process.exit(1)
|
|
121
|
+
})
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
See the [hapi-pino README](https://npm.im/hapi-pino) for more info.
|
|
125
|
+
|
|
126
|
+
<a id="restify"></a>
|
|
127
|
+
## Pino with Restify
|
|
128
|
+
|
|
129
|
+
```sh
|
|
130
|
+
npm install restify-pino-logger
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
```js
|
|
134
|
+
const server = require('restify').createServer({name: 'server'})
|
|
135
|
+
const pino = require('restify-pino-logger')()
|
|
136
|
+
|
|
137
|
+
server.use(pino)
|
|
138
|
+
|
|
139
|
+
server.get('/', function (req, res) {
|
|
140
|
+
req.log.info('something')
|
|
141
|
+
res.send('hello world')
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
server.listen(3000)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
See the [restify-pino-logger README](https://npm.im/restify-pino-logger) for more info.
|
|
148
|
+
|
|
149
|
+
<a id="koa"></a>
|
|
150
|
+
## Pino with Koa
|
|
151
|
+
|
|
152
|
+
```sh
|
|
153
|
+
npm install koa-pino-logger
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
```js
|
|
157
|
+
const Koa = require('koa')
|
|
158
|
+
const app = new Koa()
|
|
159
|
+
const pino = require('koa-pino-logger')()
|
|
160
|
+
|
|
161
|
+
app.use(pino)
|
|
162
|
+
|
|
163
|
+
app.use((ctx) => {
|
|
164
|
+
ctx.log.info('something else')
|
|
165
|
+
ctx.body = 'hello world'
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
app.listen(3000)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
See the [koa-pino-logger README](https://github.com/pinojs/koa-pino-logger) for more info.
|
|
172
|
+
|
|
173
|
+
<a id="http"></a>
|
|
174
|
+
## Pino with Node core `http`
|
|
175
|
+
|
|
176
|
+
```sh
|
|
177
|
+
npm install pino-http
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
```js
|
|
181
|
+
const http = require('http')
|
|
182
|
+
const server = http.createServer(handle)
|
|
183
|
+
const logger = require('pino-http')()
|
|
184
|
+
|
|
185
|
+
function handle (req, res) {
|
|
186
|
+
logger(req, res)
|
|
187
|
+
req.log.info('something else')
|
|
188
|
+
res.end('hello world')
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
server.listen(3000)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
See the [pino-http README](https://npm.im/pino-http) for more info.
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
<a id="nest"></a>
|
|
198
|
+
## Pino with Nest
|
|
199
|
+
|
|
200
|
+
```sh
|
|
201
|
+
npm install nestjs-pino
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
```ts
|
|
205
|
+
import { NestFactory } from '@nestjs/core'
|
|
206
|
+
import { Controller, Get, Module } from '@nestjs/common'
|
|
207
|
+
import { LoggerModule, Logger } from 'nestjs-pino'
|
|
208
|
+
|
|
209
|
+
@Controller()
|
|
210
|
+
export class AppController {
|
|
211
|
+
constructor(private readonly logger: Logger) {}
|
|
212
|
+
|
|
213
|
+
@Get()
|
|
214
|
+
getHello() {
|
|
215
|
+
this.logger.log('something')
|
|
216
|
+
return `Hello world`
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
@Module({
|
|
221
|
+
controllers: [AppController],
|
|
222
|
+
imports: [LoggerModule.forRoot()]
|
|
223
|
+
})
|
|
224
|
+
class MyModule {}
|
|
225
|
+
|
|
226
|
+
async function bootstrap() {
|
|
227
|
+
const app = await NestFactory.create(MyModule)
|
|
228
|
+
await app.listen(3000)
|
|
229
|
+
}
|
|
230
|
+
bootstrap()
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
See the [nestjs-pino README](https://npm.im/nestjs-pino) for more info.
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
<a id="h3"></a>
|
|
237
|
+
## Pino with H3
|
|
238
|
+
|
|
239
|
+
```sh
|
|
240
|
+
npm install pino-http h3
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Save as `server.mjs`:
|
|
244
|
+
|
|
245
|
+
```js
|
|
246
|
+
import { createApp, createRouter, eventHandler, fromNodeMiddleware } from "h3";
|
|
247
|
+
import pino from 'pino-http'
|
|
248
|
+
|
|
249
|
+
export const app = createApp();
|
|
250
|
+
|
|
251
|
+
const router = createRouter();
|
|
252
|
+
app.use(router);
|
|
253
|
+
app.use(fromNodeMiddleware(pino()))
|
|
254
|
+
|
|
255
|
+
app.use(eventHandler((event) => {
|
|
256
|
+
event.node.req.log.info('something')
|
|
257
|
+
return 'hello world'
|
|
258
|
+
}))
|
|
259
|
+
|
|
260
|
+
router.get(
|
|
261
|
+
"/",
|
|
262
|
+
eventHandler((event) => {
|
|
263
|
+
return { path: event.path, message: "Hello World!" };
|
|
264
|
+
}),
|
|
265
|
+
);
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Execute `npx --yes listhen -w --open ./server.mjs`.
|
|
269
|
+
|
|
270
|
+
See the [pino-http README](https://npm.im/pino-http) for more info.
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
<a id="hono"></a>
|
|
274
|
+
## Pino with Hono
|
|
275
|
+
|
|
276
|
+
```sh
|
|
277
|
+
npm install pino @hono/structured-logger hono
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
```js
|
|
281
|
+
import { serve } from '@hono/node-server';
|
|
282
|
+
import { Hono } from 'hono';
|
|
283
|
+
import { requestId } from 'hono/request-id';
|
|
284
|
+
import { structuredLogger } from '@hono/structured-logger';
|
|
285
|
+
import pino from 'pino';
|
|
286
|
+
|
|
287
|
+
const rootLogger = pino();
|
|
288
|
+
|
|
289
|
+
const app = new Hono();
|
|
290
|
+
app.use(requestId());
|
|
291
|
+
app.use(
|
|
292
|
+
structuredLogger({
|
|
293
|
+
createLogger: (c) => rootLogger.child({ requestId: c.var.requestId }),
|
|
294
|
+
})
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
app.get('/', (c) => {
|
|
298
|
+
c.var.logger.info('something');
|
|
299
|
+
|
|
300
|
+
return c.text('Hello Node.js!');
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
serve(app);
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
See the [@hono/structured-logger README](https://github.com/honojs/middleware/blob/main/packages/structured-logger/README.md) for more info.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { defineConfig, globalIgnores } = require('eslint/config')
|
|
4
|
+
const neostandard = require('neostandard')
|
|
5
|
+
|
|
6
|
+
module.exports = defineConfig([
|
|
7
|
+
neostandard({
|
|
8
|
+
ts: true
|
|
9
|
+
}),
|
|
10
|
+
globalIgnores([
|
|
11
|
+
'test/fixtures/syntax-error-esm.mjs',
|
|
12
|
+
'test/fixtures/ts/*cjs'
|
|
13
|
+
]),
|
|
14
|
+
{
|
|
15
|
+
rules: {
|
|
16
|
+
'comma-dangle': ['error', 'never'],
|
|
17
|
+
'no-var': 'off'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
files: ['pino.d.ts'],
|
|
22
|
+
rules: {
|
|
23
|
+
'@typescript-eslint/no-use-before-define': 'off',
|
|
24
|
+
'@typescript-eslint/no-unused-vars': 'off'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
files: ['test/types/**/*'],
|
|
29
|
+
rules: {
|
|
30
|
+
'no-unused-expressions': 'off',
|
|
31
|
+
'@typescript-eslint/no-unused-expressions': 'off',
|
|
32
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
33
|
+
'n/handle-callback-err': 'off'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
])
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
// Pino's primary usage writes ndjson to `stdout`:
|
|
4
|
+
const pino = require('..')()
|
|
5
|
+
|
|
6
|
+
// However, if "human readable" output is desired,
|
|
7
|
+
// `pino-pretty` can be provided as the destination
|
|
8
|
+
// stream by uncommenting the following line in place
|
|
9
|
+
// of the previous declaration:
|
|
10
|
+
// const pino = require('..')(require('pino-pretty')())
|
|
11
|
+
|
|
12
|
+
pino.info('hello world')
|
|
13
|
+
pino.error('this is at error level')
|
|
14
|
+
pino.info('the answer is %d', 42)
|
|
15
|
+
pino.info({ obj: 42 }, 'hello world')
|
|
16
|
+
pino.info({ obj: 42, b: 2 }, 'hello world')
|
|
17
|
+
pino.info({ nested: { obj: 42 } }, 'nested')
|
|
18
|
+
setImmediate(() => {
|
|
19
|
+
pino.info('after setImmediate')
|
|
20
|
+
})
|
|
21
|
+
pino.error(new Error('an error'))
|
|
22
|
+
|
|
23
|
+
const child = pino.child({ a: 'property' })
|
|
24
|
+
child.info('hello child!')
|
|
25
|
+
|
|
26
|
+
const childsChild = child.child({ another: 'property' })
|
|
27
|
+
childsChild.info('hello baby..')
|
|
28
|
+
|
|
29
|
+
pino.debug('this should be mute')
|
|
30
|
+
|
|
31
|
+
pino.level = 'trace'
|
|
32
|
+
|
|
33
|
+
pino.debug('this is a debug statement')
|
|
34
|
+
|
|
35
|
+
pino.child({ another: 'property' }).debug('this is a debug statement via child')
|
|
36
|
+
pino.trace('this is a trace statement')
|
|
37
|
+
|
|
38
|
+
pino.debug('this is a "debug" statement with "')
|
|
39
|
+
|
|
40
|
+
pino.info(new Error('kaboom'))
|
|
41
|
+
pino.info(null)
|
|
42
|
+
|
|
43
|
+
pino.info(new Error('kaboom'), 'with', 'a', 'message')
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const pino = require('..')
|
|
4
|
+
const { tmpdir } = require('node:os')
|
|
5
|
+
const { join } = require('node:path')
|
|
6
|
+
|
|
7
|
+
const file = join(tmpdir(), `pino-${process.pid}-example`)
|
|
8
|
+
|
|
9
|
+
const transport = pino.transport({
|
|
10
|
+
targets: [{
|
|
11
|
+
level: 'warn',
|
|
12
|
+
target: 'pino/file',
|
|
13
|
+
options: {
|
|
14
|
+
destination: file
|
|
15
|
+
}
|
|
16
|
+
/*
|
|
17
|
+
}, {
|
|
18
|
+
level: 'info',
|
|
19
|
+
target: 'pino-elasticsearch',
|
|
20
|
+
options: {
|
|
21
|
+
node: 'http://localhost:9200'
|
|
22
|
+
}
|
|
23
|
+
*/
|
|
24
|
+
}, {
|
|
25
|
+
level: 'info',
|
|
26
|
+
target: 'pino-pretty'
|
|
27
|
+
}]
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const logger = pino(transport)
|
|
31
|
+
|
|
32
|
+
logger.info({
|
|
33
|
+
file
|
|
34
|
+
}, 'logging destination')
|
|
35
|
+
|
|
36
|
+
logger.info('hello world')
|
|
37
|
+
logger.error('this is at error level')
|
|
38
|
+
logger.info('the answer is %d', 42)
|
|
39
|
+
logger.info({ obj: 42 }, 'hello world')
|
|
40
|
+
logger.info({ obj: 42, b: 2 }, 'hello world')
|
|
41
|
+
logger.info({ nested: { obj: 42 } }, 'nested')
|
|
42
|
+
logger.warn('WARNING!')
|
|
43
|
+
setImmediate(() => {
|
|
44
|
+
logger.info('after setImmediate')
|
|
45
|
+
})
|
|
46
|
+
logger.error(new Error('an error'))
|
|
47
|
+
|
|
48
|
+
const child = logger.child({ a: 'property' })
|
|
49
|
+
child.info('hello child!')
|
|
50
|
+
|
|
51
|
+
const childsChild = child.child({ another: 'property' })
|
|
52
|
+
childsChild.info('hello baby..')
|
|
53
|
+
|
|
54
|
+
logger.debug('this should be mute')
|
|
55
|
+
|
|
56
|
+
logger.level = 'trace'
|
|
57
|
+
|
|
58
|
+
logger.debug('this is a debug statement')
|
|
59
|
+
|
|
60
|
+
logger.child({ another: 'property' }).debug('this is a debug statement via child')
|
|
61
|
+
logger.trace('this is a trace statement')
|
|
62
|
+
|
|
63
|
+
logger.debug('this is a "debug" statement with "')
|
|
64
|
+
|
|
65
|
+
logger.info(new Error('kaboom'))
|
|
66
|
+
logger.info(null)
|
|
67
|
+
|
|
68
|
+
logger.info(new Error('kaboom'), 'with', 'a', 'message')
|
|
Binary file
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const pino = require('./pino')
|
|
4
|
+
const { once } = require('node:events')
|
|
5
|
+
|
|
6
|
+
module.exports = async function (opts = {}) {
|
|
7
|
+
const destOpts = Object.assign({}, opts, { dest: opts.destination || 1, sync: false })
|
|
8
|
+
delete destOpts.destination
|
|
9
|
+
const destination = pino.destination(destOpts)
|
|
10
|
+
await once(destination, 'ready')
|
|
11
|
+
return destination
|
|
12
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
set -e
|
|
4
|
+
|
|
5
|
+
PATH=./node_modules/.bin:${PATH}
|
|
6
|
+
CURRENT_VERSION=$(jq -r .version package.json)
|
|
7
|
+
|
|
8
|
+
case ${1} in
|
|
9
|
+
Major | MAJOR | major)
|
|
10
|
+
LEVEL=major
|
|
11
|
+
;;
|
|
12
|
+
|
|
13
|
+
Minor | MINOR | minor)
|
|
14
|
+
LEVEL=minor
|
|
15
|
+
;;
|
|
16
|
+
|
|
17
|
+
Patch | PATCH | patch)
|
|
18
|
+
LEVEL=patch
|
|
19
|
+
;;
|
|
20
|
+
|
|
21
|
+
*)
|
|
22
|
+
LEVEL=patch
|
|
23
|
+
;;
|
|
24
|
+
esac
|
|
25
|
+
|
|
26
|
+
NEW_VERSION=$(semver -i ${LEVEL} ${CURRENT_VERSION})
|
|
27
|
+
echo "${CURRENT_VERSION} => ${NEW_VERSION}"
|
|
28
|
+
read -n 1 -s -r -p "Press any key to continue (ctrl+c to abort)..."
|
|
29
|
+
echo ""
|
|
30
|
+
|
|
31
|
+
echo "Patching package.json..."
|
|
32
|
+
cat package.json | \
|
|
33
|
+
jq --arg vers "${NEW_VERSION}" '.version = $vers' | \
|
|
34
|
+
tee package.json 1>/dev/null
|
|
35
|
+
|
|
36
|
+
echo "Patching lib/meta.js ..."
|
|
37
|
+
SED_SCRIPT=$(printf 's/%s/%s/' ${CURRENT_VERSION//\./\\.} ${NEW_VERSION//\./\\.})
|
|
38
|
+
cat ./lib/meta.js | \
|
|
39
|
+
sed -e ${SED_SCRIPT} | \
|
|
40
|
+
tee ./lib/meta.js 1>/dev/null
|
|
41
|
+
|
|
42
|
+
echo "Done."
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>Pino - Super fast, all natural JSON logger for Node.js</title>
|
|
6
|
+
<meta name="description" content="Super fast, all natural JSON logger for Node.js">
|
|
7
|
+
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
8
|
+
<link rel="stylesheet" href="//unpkg.com/docsify-themeable/dist/css/theme-simple.css">
|
|
9
|
+
<style>
|
|
10
|
+
:root {
|
|
11
|
+
--base-font-size: 16px;
|
|
12
|
+
--theme-color: rgb(104, 118, 52);
|
|
13
|
+
--link-color: rgb(104, 118, 52);
|
|
14
|
+
--link-color--hover: rgb(137, 152, 100);
|
|
15
|
+
--sidebar-name-margin: 0;
|
|
16
|
+
--sidebar-name-padding: 0;
|
|
17
|
+
--code-font-size: .9em;
|
|
18
|
+
}
|
|
19
|
+
.sidebar > h1 {
|
|
20
|
+
margin-bottom: -.75em;
|
|
21
|
+
margin-top: .75em;
|
|
22
|
+
}
|
|
23
|
+
.sidebar > h1 img {
|
|
24
|
+
height: 4em;
|
|
25
|
+
}
|
|
26
|
+
.markdown-section a code {
|
|
27
|
+
color: var(--link-color)!important;
|
|
28
|
+
}
|
|
29
|
+
.markdown-section code:not([class*="lang-"]):not([class*="language-"]) {
|
|
30
|
+
white-space: unset
|
|
31
|
+
}
|
|
32
|
+
</style>
|
|
33
|
+
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
|
|
34
|
+
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
|
|
35
|
+
</head>
|
|
36
|
+
<body>
|
|
37
|
+
<div id="app"></div>
|
|
38
|
+
</body>
|
|
39
|
+
<script>
|
|
40
|
+
window.$docsify = {
|
|
41
|
+
name: 'pino',
|
|
42
|
+
logo: './pino-tree.png',
|
|
43
|
+
loadSidebar: 'docsify/sidebar.md',
|
|
44
|
+
repo: 'https://github.com/pinojs/pino',
|
|
45
|
+
auto2top: true,
|
|
46
|
+
ga: 'UA-103155139-1'
|
|
47
|
+
}
|
|
48
|
+
</script>
|
|
49
|
+
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
|
50
|
+
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
|
|
51
|
+
<script src="//unpkg.com/docsify/lib/plugins/ga.min.js"></script>
|
|
52
|
+
<!-- To enable syntax highlighting on TypeScript codes: -->
|
|
53
|
+
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-typescript.min.js"></script>
|
|
54
|
+
|
|
55
|
+
</html>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const util = require('node:util')
|
|
4
|
+
|
|
5
|
+
// getCallSite requires Node >=22.9.0
|
|
6
|
+
// getCallSite was renamed in Node 23.3.0 / 22.12.0
|
|
7
|
+
const getCallSites = util.getCallSites ?? util.getCallSite
|
|
8
|
+
|
|
9
|
+
function noOpPrepareStackTrace (_, stack) {
|
|
10
|
+
return stack
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
module.exports = function getCallers () {
|
|
14
|
+
if (getCallSites) {
|
|
15
|
+
return getCallSites().slice(2).map(callSite => callSite.scriptName)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const originalPrepare = Error.prepareStackTrace
|
|
19
|
+
Error.prepareStackTrace = noOpPrepareStackTrace
|
|
20
|
+
const stack = new Error().stack
|
|
21
|
+
Error.prepareStackTrace = originalPrepare
|
|
22
|
+
|
|
23
|
+
if (!Array.isArray(stack)) {
|
|
24
|
+
return undefined
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const entries = stack.slice(2)
|
|
28
|
+
|
|
29
|
+
const fileNames = []
|
|
30
|
+
|
|
31
|
+
for (const entry of entries) {
|
|
32
|
+
if (!entry) {
|
|
33
|
+
continue
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
fileNames.push(entry.getFileName())
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return fileNames
|
|
40
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents default log level values
|
|
3
|
+
*
|
|
4
|
+
* @enum {number}
|
|
5
|
+
*/
|
|
6
|
+
const DEFAULT_LEVELS = {
|
|
7
|
+
trace: 10,
|
|
8
|
+
debug: 20,
|
|
9
|
+
info: 30,
|
|
10
|
+
warn: 40,
|
|
11
|
+
error: 50,
|
|
12
|
+
fatal: 60
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents sort order direction: `ascending` or `descending`
|
|
17
|
+
*
|
|
18
|
+
* @enum {string}
|
|
19
|
+
*/
|
|
20
|
+
const SORTING_ORDER = {
|
|
21
|
+
ASC: 'ASC',
|
|
22
|
+
DESC: 'DESC'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = {
|
|
26
|
+
DEFAULT_LEVELS,
|
|
27
|
+
SORTING_ORDER
|
|
28
|
+
}
|