@venizia/ignis-helpers 0.4.7-0 → 0.4.7-2
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/LICENSE.md +1 -3
- package/README.md +7 -8
- package/dist/esm/common/redact.d.ts +25 -17
- package/dist/esm/common/redact.d.ts.map +1 -1
- package/dist/esm/common/redact.js +50 -46
- package/dist/esm/common/redact.js.map +1 -1
- package/dist/esm/common/resolvers.d.ts +7 -5
- package/dist/esm/common/resolvers.d.ts.map +1 -1
- package/dist/esm/common/resolvers.js +11 -9
- package/dist/esm/common/resolvers.js.map +1 -1
- package/dist/esm/core.d.ts +5 -3
- package/dist/esm/core.d.ts.map +1 -1
- package/dist/esm/core.js +7 -3
- package/dist/esm/core.js.map +1 -1
- package/dist/esm/modules/base.d.ts +1 -1
- package/dist/esm/modules/base.d.ts.map +1 -1
- package/dist/esm/modules/base.js +14 -5
- package/dist/esm/modules/base.js.map +1 -1
- package/dist/esm/modules/cron/helper.js +4 -4
- package/dist/esm/modules/cron/helper.js.map +1 -1
- package/dist/esm/modules/crypto/algorithms/aes-legacy.algorithm.js +3 -3
- package/dist/esm/modules/crypto/algorithms/aes-legacy.algorithm.js.map +1 -1
- package/dist/esm/modules/crypto/algorithms/aes.algorithm.js +5 -5
- package/dist/esm/modules/crypto/algorithms/aes.algorithm.js.map +1 -1
- package/dist/esm/modules/crypto/algorithms/base.algorithm.js +3 -3
- package/dist/esm/modules/crypto/algorithms/base.algorithm.js.map +1 -1
- package/dist/esm/modules/crypto/algorithms/hash.algorithm.d.ts +15 -5
- package/dist/esm/modules/crypto/algorithms/hash.algorithm.d.ts.map +1 -1
- package/dist/esm/modules/crypto/algorithms/hash.algorithm.js +16 -4
- package/dist/esm/modules/crypto/algorithms/hash.algorithm.js.map +1 -1
- package/dist/esm/modules/env/app-env.d.ts.map +1 -1
- package/dist/esm/modules/env/app-env.js +2 -2
- package/dist/esm/modules/env/app-env.js.map +1 -1
- package/dist/esm/modules/logger/base/base.d.ts.map +1 -1
- package/dist/esm/modules/logger/base/base.js +3 -3
- package/dist/esm/modules/logger/base/base.js.map +1 -1
- package/dist/esm/modules/logger/base/console.d.ts +9 -4
- package/dist/esm/modules/logger/base/console.d.ts.map +1 -1
- package/dist/esm/modules/logger/base/console.js +15 -4
- package/dist/esm/modules/logger/base/console.js.map +1 -1
- package/dist/esm/modules/logger/common/constants.d.ts +23 -22
- package/dist/esm/modules/logger/common/constants.d.ts.map +1 -1
- package/dist/esm/modules/logger/common/constants.js +43 -46
- package/dist/esm/modules/logger/common/constants.js.map +1 -1
- package/dist/esm/modules/logger/common/debug-gate.d.ts +33 -0
- package/dist/esm/modules/logger/common/debug-gate.d.ts.map +1 -0
- package/dist/esm/modules/logger/common/debug-gate.js +51 -0
- package/dist/esm/modules/logger/common/debug-gate.js.map +1 -0
- package/dist/esm/modules/logger/common/index.d.ts +1 -0
- package/dist/esm/modules/logger/common/index.d.ts.map +1 -1
- package/dist/esm/modules/logger/common/index.js +1 -0
- package/dist/esm/modules/logger/common/index.js.map +1 -1
- package/dist/esm/modules/logger/common/types.d.ts +7 -0
- package/dist/esm/modules/logger/common/types.d.ts.map +1 -1
- package/dist/esm/modules/logger/common/types.js +16 -0
- package/dist/esm/modules/logger/common/types.js.map +1 -1
- package/dist/esm/modules/logger/factory.d.ts +29 -10
- package/dist/esm/modules/logger/factory.d.ts.map +1 -1
- package/dist/esm/modules/logger/factory.js +108 -48
- package/dist/esm/modules/logger/factory.js.map +1 -1
- package/dist/esm/modules/logger/formatting/deep-splat.d.ts +10 -6
- package/dist/esm/modules/logger/formatting/deep-splat.d.ts.map +1 -1
- package/dist/esm/modules/logger/formatting/deep-splat.js +73 -62
- package/dist/esm/modules/logger/formatting/deep-splat.js.map +1 -1
- package/dist/esm/modules/logger/formatting/error-prettier.d.ts.map +1 -1
- package/dist/esm/modules/logger/formatting/error-prettier.js +8 -6
- package/dist/esm/modules/logger/formatting/error-prettier.js.map +1 -1
- package/dist/esm/modules/logger/hf/logger.d.ts.map +1 -1
- package/dist/esm/modules/logger/hf/logger.js +5 -5
- package/dist/esm/modules/logger/hf/logger.js.map +1 -1
- package/dist/esm/modules/logger/index.d.ts +0 -1
- package/dist/esm/modules/logger/index.d.ts.map +1 -1
- package/dist/esm/modules/logger/index.js +0 -1
- package/dist/esm/modules/logger/index.js.map +1 -1
- package/dist/esm/modules/logger/pino/backing.d.ts +0 -9
- package/dist/esm/modules/logger/pino/backing.d.ts.map +1 -1
- package/dist/esm/modules/logger/pino/backing.js +3 -8
- package/dist/esm/modules/logger/pino/backing.js.map +1 -1
- package/dist/esm/modules/logger/pino/destination.d.ts +6 -9
- package/dist/esm/modules/logger/pino/destination.d.ts.map +1 -1
- package/dist/esm/modules/logger/pino/destination.js +12 -13
- package/dist/esm/modules/logger/pino/destination.js.map +1 -1
- package/dist/esm/modules/logger/pino/logger.js +2 -2
- package/dist/esm/modules/logger/pino/logger.js.map +1 -1
- package/dist/esm/modules/logger/winston/common/constants.d.ts.map +1 -1
- package/dist/esm/modules/logger/winston/common/constants.js +7 -6
- package/dist/esm/modules/logger/winston/common/constants.js.map +1 -1
- package/dist/esm/modules/logger/winston/define.d.ts +0 -7
- package/dist/esm/modules/logger/winston/define.d.ts.map +1 -1
- package/dist/esm/modules/logger/winston/define.js +0 -5
- package/dist/esm/modules/logger/winston/define.js.map +1 -1
- package/dist/esm/modules/logger/winston/formats.d.ts +2 -0
- package/dist/esm/modules/logger/winston/formats.d.ts.map +1 -1
- package/dist/esm/modules/logger/winston/formats.js +17 -4
- package/dist/esm/modules/logger/winston/formats.js.map +1 -1
- package/dist/esm/modules/logger/winston/index.d.ts +3 -2
- package/dist/esm/modules/logger/winston/index.d.ts.map +1 -1
- package/dist/esm/modules/logger/winston/index.js +3 -2
- package/dist/esm/modules/logger/winston/index.js.map +1 -1
- package/dist/esm/modules/logger/winston/logger-factory.js +4 -4
- package/dist/esm/modules/logger/winston/logger-factory.js.map +1 -1
- package/dist/esm/modules/network/http-request/base-network-request.helper.js +2 -2
- package/dist/esm/modules/network/http-request/base-network-request.helper.js.map +1 -1
- package/dist/esm/modules/network/http-request/common/index.d.ts +0 -1
- package/dist/esm/modules/network/http-request/common/index.d.ts.map +1 -1
- package/dist/esm/modules/network/http-request/common/index.js +0 -1
- package/dist/esm/modules/network/http-request/common/index.js.map +1 -1
- package/dist/esm/modules/network/http-request/fetcher/axios-fetcher.d.ts.map +1 -1
- package/dist/esm/modules/network/http-request/fetcher/axios-fetcher.js +4 -2
- package/dist/esm/modules/network/http-request/fetcher/axios-fetcher.js.map +1 -1
- package/dist/esm/modules/network/http-request/fetcher/node-fetcher.d.ts.map +1 -1
- package/dist/esm/modules/network/http-request/fetcher/node-fetcher.js +6 -4
- package/dist/esm/modules/network/http-request/fetcher/node-fetcher.js.map +1 -1
- package/dist/esm/modules/network/tcp-socket/base-tcp-client.helper.js +4 -4
- package/dist/esm/modules/network/tcp-socket/base-tcp-client.helper.js.map +1 -1
- package/dist/esm/modules/network/tcp-socket/base-tcp-server.helper.js +4 -4
- package/dist/esm/modules/network/tcp-socket/base-tcp-server.helper.js.map +1 -1
- package/dist/esm/modules/network/udp-socket/network-udp-client.helper.js +2 -2
- package/dist/esm/modules/network/udp-socket/network-udp-client.helper.js.map +1 -1
- package/dist/esm/modules/network/utilities/query-string.d.ts +22 -20
- package/dist/esm/modules/network/utilities/query-string.d.ts.map +1 -1
- package/dist/esm/modules/network/utilities/query-string.js +48 -46
- package/dist/esm/modules/network/utilities/query-string.js.map +1 -1
- package/dist/esm/modules/network/utilities/url-safety/common/errors.d.ts +0 -10
- package/dist/esm/modules/network/utilities/url-safety/common/errors.d.ts.map +1 -1
- package/dist/esm/modules/network/utilities/url-safety/common/errors.js +0 -11
- package/dist/esm/modules/network/utilities/url-safety/common/errors.js.map +1 -1
- package/dist/esm/modules/network/utilities/url-safety/policy.d.ts +10 -0
- package/dist/esm/modules/network/utilities/url-safety/policy.d.ts.map +1 -1
- package/dist/esm/modules/network/utilities/url-safety/policy.js +11 -0
- package/dist/esm/modules/network/utilities/url-safety/policy.js.map +1 -1
- package/dist/esm/modules/queue/bullmq/helper.d.ts.map +1 -1
- package/dist/esm/modules/queue/bullmq/helper.js +6 -6
- package/dist/esm/modules/queue/bullmq/helper.js.map +1 -1
- package/dist/esm/modules/queue/common/hook.d.ts +14 -12
- package/dist/esm/modules/queue/common/hook.d.ts.map +1 -1
- package/dist/esm/modules/queue/common/hook.js +21 -19
- package/dist/esm/modules/queue/common/hook.js.map +1 -1
- package/dist/esm/modules/queue/common/index.d.ts +0 -1
- package/dist/esm/modules/queue/common/index.d.ts.map +1 -1
- package/dist/esm/modules/queue/common/index.js +0 -1
- package/dist/esm/modules/queue/common/index.js.map +1 -1
- package/dist/esm/modules/queue/internal/sequential/helper.js +8 -8
- package/dist/esm/modules/queue/internal/sequential/helper.js.map +1 -1
- package/dist/esm/modules/queue/kafka/base.js +3 -3
- package/dist/esm/modules/queue/kafka/base.js.map +1 -1
- package/dist/esm/modules/queue/kafka/bundler/index.d.ts +0 -2
- package/dist/esm/modules/queue/kafka/bundler/index.d.ts.map +1 -1
- package/dist/esm/modules/queue/kafka/bundler/index.js +0 -2
- package/dist/esm/modules/queue/kafka/bundler/index.js.map +1 -1
- package/dist/esm/modules/queue/kafka/bundler/plugins.d.ts +8 -2
- package/dist/esm/modules/queue/kafka/bundler/plugins.d.ts.map +1 -1
- package/dist/esm/modules/queue/kafka/bundler/plugins.js +64 -7
- package/dist/esm/modules/queue/kafka/bundler/plugins.js.map +1 -1
- package/dist/esm/modules/queue/kafka/consumer.d.ts.map +1 -1
- package/dist/esm/modules/queue/kafka/consumer.js +22 -22
- package/dist/esm/modules/queue/kafka/consumer.js.map +1 -1
- package/dist/esm/modules/queue/mqtt/helper.js +10 -10
- package/dist/esm/modules/queue/mqtt/helper.js.map +1 -1
- package/dist/esm/modules/redis/base/abstract.helper.js +8 -8
- package/dist/esm/modules/redis/base/abstract.helper.js.map +1 -1
- package/dist/esm/modules/redis/cluster/cluster.helper.js +2 -2
- package/dist/esm/modules/redis/cluster/cluster.helper.js.map +1 -1
- package/dist/esm/modules/redis/factory.d.ts +13 -9
- package/dist/esm/modules/redis/factory.d.ts.map +1 -1
- package/dist/esm/modules/redis/factory.js +15 -13
- package/dist/esm/modules/redis/factory.js.map +1 -1
- package/dist/esm/modules/redis/sentinel/sentinel.helper.js +2 -2
- package/dist/esm/modules/redis/sentinel/sentinel.helper.js.map +1 -1
- package/dist/esm/modules/redis/single/single.helper.js +2 -2
- package/dist/esm/modules/redis/single/single.helper.js.map +1 -1
- package/dist/esm/modules/redis/utility.d.ts +13 -11
- package/dist/esm/modules/redis/utility.d.ts.map +1 -1
- package/dist/esm/modules/redis/utility.js +46 -44
- package/dist/esm/modules/redis/utility.js.map +1 -1
- package/dist/esm/modules/retry/helper.js +2 -2
- package/dist/esm/modules/retry/helper.js.map +1 -1
- package/dist/esm/modules/secrets/factory.d.ts +5 -3
- package/dist/esm/modules/secrets/factory.d.ts.map +1 -1
- package/dist/esm/modules/secrets/factory.js +36 -34
- package/dist/esm/modules/secrets/factory.js.map +1 -1
- package/dist/esm/modules/socket/socket-io/server/helper.d.ts.map +1 -1
- package/dist/esm/modules/socket/socket-io/server/helper.js +11 -11
- package/dist/esm/modules/socket/socket-io/server/helper.js.map +1 -1
- package/dist/esm/modules/socket/websocket/emitter/helper.d.ts.map +1 -1
- package/dist/esm/modules/socket/websocket/emitter/helper.js +3 -3
- package/dist/esm/modules/socket/websocket/emitter/helper.js.map +1 -1
- package/dist/esm/modules/socket/websocket/server/delivery.d.ts.map +1 -1
- package/dist/esm/modules/socket/websocket/server/delivery.js +5 -6
- package/dist/esm/modules/socket/websocket/server/delivery.js.map +1 -1
- package/dist/esm/modules/socket/websocket/server/helper.d.ts.map +1 -1
- package/dist/esm/modules/socket/websocket/server/helper.js +7 -7
- package/dist/esm/modules/socket/websocket/server/helper.js.map +1 -1
- package/dist/esm/modules/storage/base.js +7 -7
- package/dist/esm/modules/storage/base.js.map +1 -1
- package/dist/esm/modules/storage/bun-s3/helper.d.ts.map +1 -1
- package/dist/esm/modules/storage/bun-s3/helper.js +25 -18
- package/dist/esm/modules/storage/bun-s3/helper.js.map +1 -1
- package/dist/esm/modules/storage/bun-s3/utility.d.ts +95 -77
- package/dist/esm/modules/storage/bun-s3/utility.d.ts.map +1 -1
- package/dist/esm/modules/storage/bun-s3/utility.js +261 -239
- package/dist/esm/modules/storage/bun-s3/utility.js.map +1 -1
- package/dist/esm/modules/storage/common/errors.d.ts +0 -4
- package/dist/esm/modules/storage/common/errors.d.ts.map +1 -1
- package/dist/esm/modules/storage/common/errors.js +0 -10
- package/dist/esm/modules/storage/common/errors.js.map +1 -1
- package/dist/esm/modules/storage/common/utility.d.ts +11 -5
- package/dist/esm/modules/storage/common/utility.d.ts.map +1 -1
- package/dist/esm/modules/storage/common/utility.js +30 -17
- package/dist/esm/modules/storage/common/utility.js.map +1 -1
- package/dist/esm/modules/uid/uuid/helper.d.ts +1 -1
- package/dist/esm/modules/uid/uuid/helper.d.ts.map +1 -1
- package/dist/esm/modules/uid/uuid/helper.js +7 -7
- package/dist/esm/modules/uid/uuid/helper.js.map +1 -1
- package/dist/esm/modules/uid/uuid/v4.d.ts +11 -8
- package/dist/esm/modules/uid/uuid/v4.d.ts.map +1 -1
- package/dist/esm/modules/uid/uuid/v4.js +51 -46
- package/dist/esm/modules/uid/uuid/v4.js.map +1 -1
- package/dist/esm/modules/uid/uuid/v5.d.ts +17 -14
- package/dist/esm/modules/uid/uuid/v5.d.ts.map +1 -1
- package/dist/esm/modules/uid/uuid/v5.js +83 -78
- package/dist/esm/modules/uid/uuid/v5.js.map +1 -1
- package/dist/esm/modules/uid/uuid/v7.d.ts +15 -10
- package/dist/esm/modules/uid/uuid/v7.d.ts.map +1 -1
- package/dist/esm/modules/uid/uuid/v7.js +88 -79
- package/dist/esm/modules/uid/uuid/v7.js.map +1 -1
- package/dist/esm/modules/worker-thread/bus/base.js +2 -2
- package/dist/esm/modules/worker-thread/bus/base.js.map +1 -1
- package/dist/esm/modules/worker-thread/worker/base.d.ts.map +1 -1
- package/dist/esm/modules/worker-thread/worker/base.js +4 -3
- package/dist/esm/modules/worker-thread/worker/base.js.map +1 -1
- package/dist/esm/utilities/error.utility.d.ts +7 -0
- package/dist/esm/utilities/error.utility.d.ts.map +1 -0
- package/dist/esm/utilities/error.utility.js +9 -0
- package/dist/esm/utilities/error.utility.js.map +1 -0
- package/dist/esm/utilities/form-body.utility.d.ts +12 -10
- package/dist/esm/utilities/form-body.utility.d.ts.map +1 -1
- package/dist/esm/utilities/form-body.utility.js +19 -17
- package/dist/esm/utilities/form-body.utility.js.map +1 -1
- package/dist/esm/utilities/hr-time.utility.d.ts +7 -5
- package/dist/esm/utilities/hr-time.utility.d.ts.map +1 -1
- package/dist/esm/utilities/hr-time.utility.js +11 -9
- package/dist/esm/utilities/hr-time.utility.js.map +1 -1
- package/dist/esm/utilities/index.d.ts +2 -2
- package/dist/esm/utilities/index.d.ts.map +1 -1
- package/dist/esm/utilities/index.js +2 -2
- package/dist/esm/utilities/index.js.map +1 -1
- package/dist/esm/utilities/module.utility.d.ts.map +1 -1
- package/dist/esm/utilities/module.utility.js +1 -0
- package/dist/esm/utilities/module.utility.js.map +1 -1
- package/dist/esm/utilities/parse.utility.d.ts +89 -43
- package/dist/esm/utilities/parse.utility.d.ts.map +1 -1
- package/dist/esm/utilities/parse.utility.js +173 -141
- package/dist/esm/utilities/parse.utility.js.map +1 -1
- package/dist/esm/utilities/performance.utility.d.ts +15 -13
- package/dist/esm/utilities/performance.utility.d.ts.map +1 -1
- package/dist/esm/utilities/performance.utility.js +34 -29
- package/dist/esm/utilities/performance.utility.js.map +1 -1
- package/dist/esm/utilities/promise.utility.d.ts +20 -18
- package/dist/esm/utilities/promise.utility.d.ts.map +1 -1
- package/dist/esm/utilities/promise.utility.js +41 -51
- package/dist/esm/utilities/promise.utility.js.map +1 -1
- package/dist/esm/utilities/request.utility.d.ts +35 -29
- package/dist/esm/utilities/request.utility.d.ts.map +1 -1
- package/dist/esm/utilities/request.utility.js +118 -115
- package/dist/esm/utilities/request.utility.js.map +1 -1
- package/package.json +4 -15
- package/dist/esm/modules/logger/resolver.d.ts +0 -33
- package/dist/esm/modules/logger/resolver.d.ts.map +0 -1
- package/dist/esm/modules/logger/resolver.js +0 -95
- package/dist/esm/modules/logger/resolver.js.map +0 -1
- package/dist/esm/modules/logger/slot.d.ts +0 -23
- package/dist/esm/modules/logger/slot.d.ts.map +0 -1
- package/dist/esm/modules/logger/slot.js +0 -119
- package/dist/esm/modules/logger/slot.js.map +0 -1
- package/dist/esm/modules/logger/winston/formatters/deep-splat.d.ts +0 -4
- package/dist/esm/modules/logger/winston/formatters/deep-splat.d.ts.map +0 -1
- package/dist/esm/modules/logger/winston/formatters/deep-splat.js +0 -14
- package/dist/esm/modules/logger/winston/formatters/deep-splat.js.map +0 -1
- package/dist/esm/modules/logger/winston/formatters/index.d.ts +0 -2
- package/dist/esm/modules/logger/winston/formatters/index.d.ts.map +0 -1
- package/dist/esm/modules/logger/winston/formatters/index.js +0 -2
- package/dist/esm/modules/logger/winston/formatters/index.js.map +0 -1
- package/dist/esm/modules/network/http-request/common/types.d.ts +0 -2
- package/dist/esm/modules/network/http-request/common/types.d.ts.map +0 -1
- package/dist/esm/modules/network/http-request/common/types.js +0 -2
- package/dist/esm/modules/network/http-request/common/types.js.map +0 -1
- package/dist/esm/modules/queue/common/types.d.ts +0 -2
- package/dist/esm/modules/queue/common/types.d.ts.map +0 -1
- package/dist/esm/modules/queue/common/types.js +0 -2
- package/dist/esm/modules/queue/common/types.js.map +0 -1
- package/dist/esm/modules/queue/kafka/bundler/platformatic-require.plugin.d.ts +0 -4
- package/dist/esm/modules/queue/kafka/bundler/platformatic-require.plugin.d.ts.map +0 -1
- package/dist/esm/modules/queue/kafka/bundler/platformatic-require.plugin.js +0 -28
- package/dist/esm/modules/queue/kafka/bundler/platformatic-require.plugin.js.map +0 -1
- package/dist/esm/modules/queue/kafka/bundler/platformatic-wasm.plugin.d.ts +0 -4
- package/dist/esm/modules/queue/kafka/bundler/platformatic-wasm.plugin.d.ts.map +0 -1
- package/dist/esm/modules/queue/kafka/bundler/platformatic-wasm.plugin.js +0 -26
- package/dist/esm/modules/queue/kafka/bundler/platformatic-wasm.plugin.js.map +0 -1
- package/dist/esm/modules/storage/minio/helper.d.ts +0 -55
- package/dist/esm/modules/storage/minio/helper.d.ts.map +0 -1
- package/dist/esm/modules/storage/minio/helper.js +0 -177
- package/dist/esm/modules/storage/minio/helper.js.map +0 -1
- package/dist/esm/modules/storage/minio/index.d.ts +0 -2
- package/dist/esm/modules/storage/minio/index.d.ts.map +0 -1
- package/dist/esm/modules/storage/minio/index.js +0 -2
- package/dist/esm/modules/storage/minio/index.js.map +0 -1
- package/dist/esm/utilities/sleep.utility.d.ts +0 -2
- package/dist/esm/utilities/sleep.utility.d.ts.map +0 -1
- package/dist/esm/utilities/sleep.utility.js +0 -4
- package/dist/esm/utilities/sleep.utility.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-prettier.js","sourceRoot":"","sources":["../../../../../src/modules/logger/formatting/error-prettier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAsB,MAAM,WAAW,CAAC;AAyB9D,yGAAyG;AACzG,MAAM,OAAO,aAAa;IACxB,qDAAqD;aACrC,4BAAuB,GAAG,CAAC,CAAC;IAE5C,kGAAkG;aAClF,6BAAwB,GAAG,EAAE,CAAC;IAE9C,iGAAiG;aACzE,oBAAe,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,CAAU,CAAC;IAE7F,yEAAyE;aACjD,kBAAa,GAAG,SAAS,CAAC;IAElD,4FAA4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AW,EACX,KAAK,EACL,YAAY,GAAG,IAAI,EACnB,cAAc,EACd,MAAM,EACN,cAAc,GAAG,IAAI,CAAC,eAAe,GACtC,GAAG,IAAI,CAAC;QAET,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC,CAAC;QAExE,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,aAAa,CAAC,IAAI,EAAE,CAAC;YACtD,OAAO,IAAI,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;QAC1D,CAAC;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC;IAC1E,CAAC","sourcesContent":["import { redactSecrets } from '@/common/redact';\nimport { MessageCode } from '@/modules/error';\nimport util from 'node:util';\nimport { LoggerFormats, type TLoggerFormat } from '../common';\n\n/** Useful-only projection of an error: a driver's `query`/`params` repeat the message and are dropped. */\nexport interface IErrorSummary {\n name?: string;\n message?: string;\n /** The error's OWN code - a driver's `23505`, a gRPC `14`. Belongs with the name, not with the message. */\n code?: string | number;\n /** An `ApplicationError`'s `normalized.code` - the identifier an application filters on. `MessageCode.DEFAULT` never surfaces. */\n messageCode?: string;\n /** Frames ONLY - V8's `Error: <message>` header is stripped so the message is not repeated. */\n stack?: string;\n hint?: string;\n detail?: string;\n table?: string;\n constraint?: string;\n /** Values for the `%{placeholder}` tokens left unresolved in `message` - i18n resolves them downstream, so the log must carry them or the message names no field. */\n args?: Record<string, unknown>;\n /** An `ApplicationError`'s caller context - the one unmodelled payload worth keeping. */\n extra?: Record<string, unknown>;\n cause?: IErrorSummary;\n /** Every reason an `AggregateError` collected. Its own message names none of them, so without this the log says only that something failed. */\n errors?: Array<IErrorSummary>;\n}\n\n/** Turns a thrown value into something a human can read in a console - log this, never the raw error. */\nexport class ErrorPrettier {\n /** Bounds a pathological or cyclic `cause` chain. */\n static readonly DEFAULT_MAX_CAUSE_DEPTH = 5;\n\n /** The throw site is near the top; the tail is identical framework plumbing for every request. */\n static readonly DEFAULT_MAX_STACK_FRAMES = 10;\n\n /** Driver diagnostics that are actionable and absent from `message` - `pg` supplies all four. */\n private static readonly DIAGNOSTIC_KEYS = ['hint', 'detail', 'table', 'constraint'] as const;\n\n /** A stack frame line in every V8 stack: ` at fn (file:line:col)`. */\n private static readonly FRAME_PATTERN = /^\\s+at /;\n\n /** A frame inside an installed package - `node_modules/` covers bun's `.bun/` store too. */\n private static readonly DEPENDENCY_FRAME_PATTERN = /node_modules[/\\\\]/;\n\n /** `getError` sits on top of every `ApplicationError` stack and names no call site. Installed, it is also the FIRST dependency frame, so the keep-the-first rule would preserve exactly the wrong one. Anchored on `inversion` so an application's own `modules/error/app-error` is not swallowed with it. */\n private static readonly ERROR_FACTORY_FRAME_PATTERN =\n /inversion[/\\\\].*modules[/\\\\]error[/\\\\]app-error/;\n\n /** Issues rendered from a ZodError before the rest are counted off. */\n private static readonly MAX_ZOD_ISSUES = 10;\n\n /** Members of an `AggregateError` rendered before the rest are counted off. */\n private static readonly MAX_AGGREGATED_ERRORS = 10;\n\n private static readonly INSPECT_OPTIONS: util.InspectOptions = {\n depth: 5,\n maxArrayLength: null,\n maxStringLength: null,\n breakLength: Infinity,\n };\n\n private static extractFrames(opts: { stack: unknown; maxFrames: number }): string | undefined {\n const { stack, maxFrames } = opts;\n\n if (typeof stack !== 'string') {\n return undefined;\n }\n\n const frames: Array<string> = [];\n let keptDependencyFrame = false;\n let omitted = 0;\n\n // Hand-rolled over split+filter+slice: it stops at maxFrames instead of walking the whole stack.\n const lines = stack.split('\\n');\n for (const line of lines) {\n if (!this.FRAME_PATTERN.test(line)) {\n continue;\n }\n\n // Not counted as omitted: a factory frame is noise, and reporting it would imply signal was dropped.\n if (this.ERROR_FACTORY_FRAME_PATTERN.test(line)) {\n continue;\n }\n\n // The FIRST dependency frame is often the throw site (drizzle, jose); every later one is plumbing.\n const isDependencyFrame = this.DEPENDENCY_FRAME_PATTERN.test(line);\n\n if (isDependencyFrame && keptDependencyFrame) {\n omitted += 1;\n continue;\n }\n\n keptDependencyFrame = keptDependencyFrame || isDependencyFrame;\n frames.push(line);\n\n if (frames.length === maxFrames) {\n break;\n }\n }\n\n // Emit nothing rather than the header, which would repeat the message.\n if (frames.length === 0) {\n return undefined;\n }\n\n // Never truncate silently - a reader must know frames are missing, not assume the stack ended.\n return omitted > 0\n ? `${frames.join('\\n')}\\n ... ${omitted} dependency frames`\n : frames.join('\\n');\n }\n\n /** A ZodError's `message` is its issue array as pretty JSON - dozens of lines for one bad field. Render `path: reason` instead. */\n private static compressZodMessage(opts: { message: string }): string {\n const { message } = opts;\n\n let issues: unknown;\n\n try {\n issues = JSON.parse(message);\n } catch {\n // Not the JSON form (an already-formatted or hand-built ZodError) - leave it alone.\n return message;\n }\n\n if (!Array.isArray(issues) || issues.length === 0) {\n return message;\n }\n\n const lines = issues.slice(0, this.MAX_ZOD_ISSUES).map((issue) => {\n const entry = issue as { path?: Array<string | number>; message?: string; code?: string };\n const path =\n Array.isArray(entry.path) && entry.path.length > 0 ? entry.path.join('.') : '(root)';\n\n return `${path}: ${entry.message ?? entry.code ?? 'invalid'}`;\n });\n\n const remaining = issues.length - lines.length;\n\n return remaining > 0 ? `${lines.join('\\n')}\\n... and ${remaining} more` : lines.join('\\n');\n }\n\n private static summarizeNode(opts: {\n value: unknown;\n depthLeft: number;\n seen: WeakSet<object>;\n isRoot: boolean;\n includeStack: boolean;\n maxStackFrames: number;\n }): IErrorSummary {\n const { value, depthLeft, seen, isRoot, includeStack, maxStackFrames } = opts;\n\n // A primitive - a string thrown as `cause`, a numeric code - is its own message.\n if (typeof value !== 'object' || value === null) {\n return { message: String(value) };\n }\n\n if (seen.has(value)) {\n return { message: '[Circular]' };\n }\n seen.add(value);\n\n const source = value as Record<string, unknown>;\n const summary: IErrorSummary = {};\n\n if (typeof source.name === 'string') {\n summary.name = source.name;\n }\n\n if (typeof source.message === 'string') {\n summary.message =\n source.name === 'ZodError'\n ? this.compressZodMessage({ message: source.message })\n : source.message;\n }\n\n if (typeof source.code === 'string' || typeof source.code === 'number') {\n summary.code = source.code;\n }\n\n const normalized =\n typeof source.normalized === 'object' && source.normalized !== null\n ? (source.normalized as { code?: unknown; args?: unknown })\n : undefined;\n\n // `MessageCode.resolve` stamps DEFAULT on every codeless error, so surfacing it blindly would put a meaningless line on every log.\n if (typeof normalized?.code === 'string' && normalized.code !== MessageCode.DEFAULT) {\n summary.messageCode = normalized.code;\n }\n\n // Root only: a cause's frames point into the same libraries and add no location the root lacks.\n if (isRoot && includeStack) {\n const frames = this.extractFrames({ stack: source.stack, maxFrames: maxStackFrames });\n if (frames !== undefined) {\n summary.stack = frames;\n }\n }\n\n for (const key of this.DIAGNOSTIC_KEYS) {\n const diagnostic = source[key];\n if (typeof diagnostic === 'string' && diagnostic.length > 0) {\n summary[key] = diagnostic;\n }\n }\n\n // Root only: the args fill the ROOT's message; a cause's belong to a message this block does not print.\n if (isRoot && typeof normalized?.args === 'object' && normalized.args !== null) {\n const args = normalized.args as Record<string, unknown>;\n if (Object.keys(args).length > 0) {\n summary.args = args;\n }\n }\n\n // Root only: `extra` is what a throw site deliberately attached, so a direct log call keeps it.\n if (isRoot && typeof source.extra === 'object' && source.extra !== null) {\n const extra = source.extra as Record<string, unknown>;\n if (Object.keys(extra).length > 0) {\n summary.extra = extra;\n }\n }\n\n if (source.cause !== undefined && source.cause !== null && depthLeft > 0) {\n summary.cause = this.summarizeNode({\n value: source.cause,\n depthLeft: depthLeft - 1,\n seen,\n isRoot: false,\n includeStack,\n maxStackFrames,\n });\n }\n\n // A protocol client reports one member per thing that failed; the wrapper carries only a generic sentence.\n if (Array.isArray(source.errors) && source.errors.length > 0 && depthLeft > 0) {\n const members = source.errors.slice(0, this.MAX_AGGREGATED_ERRORS).map((member) =>\n this.summarizeNode({\n value: member,\n depthLeft: depthLeft - 1,\n seen,\n isRoot: false,\n includeStack,\n maxStackFrames,\n }),\n );\n\n const remaining = source.errors.length - members.length;\n if (remaining > 0) {\n members.push({ message: `... and ${remaining} more` });\n }\n\n summary.errors = members;\n }\n\n // Nothing recognizable: inspect it (redacted) so an unmodelled shape still reaches the log.\n if (Object.keys(summary).length === 0) {\n return { message: util.inspect(redactSecrets(value), this.INSPECT_OPTIONS) };\n }\n\n return summary;\n }\n\n private static pushDiagnostics(opts: { node: IErrorSummary; lines: Array<string> }): void {\n const { node, lines } = opts;\n\n for (const key of this.DIAGNOSTIC_KEYS) {\n const diagnostic = node[key];\n if (diagnostic !== undefined) {\n lines.push(`${key}: ${diagnostic}`);\n }\n }\n }\n\n /** Under whichever node collected them - a wrapped `AggregateError` is the common shape. */\n private static pushAggregatedErrors(opts: { node: IErrorSummary; lines: Array<string> }): void {\n const { node, lines } = opts;\n\n node.errors?.forEach((member, index) => {\n const memberCode = member.code ?? member.messageCode;\n const code = memberCode === undefined ? '' : ` (code ${memberCode})`;\n lines.push(`errors[${index}]: ${member.message ?? ''}${code}`);\n this.pushDiagnostics({ node: member, lines });\n });\n }\n\n /** Reduces any thrown value to {@link IErrorSummary} - always a summary, never a bare primitive. */\n static summarize(opts: {\n error: unknown;\n includeStack?: boolean;\n maxCauseDepth?: number;\n maxStackFrames?: number;\n }): IErrorSummary {\n const {\n error,\n includeStack = true,\n maxCauseDepth = this.DEFAULT_MAX_CAUSE_DEPTH,\n maxStackFrames = this.DEFAULT_MAX_STACK_FRAMES,\n } = opts;\n\n return this.summarizeNode({\n value: error,\n depthLeft: maxCauseDepth,\n seen: new WeakSet(),\n isRoot: true,\n includeStack,\n maxStackFrames,\n });\n }\n\n /** Resolved per call, not at module load, so a test passes a value instead of mutating the environment. */\n private static resolveFormat(configured?: TLoggerFormat): TLoggerFormat {\n if (configured !== undefined) {\n return configured;\n }\n\n const fromEnv = process.env.APP_ENV_LOGGER_FORMAT;\n\n return fromEnv !== undefined && LoggerFormats.isValid(fromEnv) ? fromEnv : LoggerFormats.TEXT;\n }\n\n /** `JSON.stringify` throws on a cycle, and `format` runs inside the error handler - a throw there turns a handled failure into an unhandled one. `redactSecrets` breaks cycles on its own, but it is switched off by `APP_ENV_LOGGER_DO_REDACT=false`, so structural safety cannot lean on it. A repeated reference reads as `[Circular]` too: the first occurrence still carries the data. */\n private static safeStringify(payload: Record<string, unknown>): string {\n const seen = new WeakSet<object>();\n\n return JSON.stringify(payload, (_key, value: unknown) => {\n if (typeof value !== 'object' || value === null) {\n return value;\n }\n\n if (seen.has(value)) {\n return '[Circular]';\n }\n\n seen.add(value);\n return value;\n });\n }\n\n /** One line, so a log monitor keeps the error as ONE record instead of one per bullet. */\n private static renderJson(opts: {\n summary: IErrorSummary;\n messageCode?: string;\n extra?: Record<string, unknown>;\n }): string {\n const { summary, messageCode, extra } = opts;\n\n const payload: Record<string, unknown> = {};\n\n if (summary.message !== undefined) {\n payload.message = summary.message;\n }\n\n if (summary.args !== undefined) {\n payload.args = redactSecrets(summary.args);\n }\n\n // An ApplicationError has no own `code` and a driver error has no `normalized`, so one field never hides the other.\n const code =\n messageCode !== undefined && messageCode !== ''\n ? messageCode\n : (summary.messageCode ?? summary.code);\n if (code !== undefined) {\n payload.code = code;\n }\n\n // A bare `Error` says nothing; the text block drops it for the same reason.\n if (summary.name !== undefined && summary.name !== 'Error') {\n payload.name = summary.name;\n }\n\n for (const key of this.DIAGNOSTIC_KEYS) {\n if (summary[key] !== undefined) {\n payload[key] = summary[key];\n }\n }\n\n const context = extra ?? summary.extra;\n if (context !== undefined && Object.keys(context).length > 0) {\n payload.extra = redactSecrets(context);\n }\n\n if (summary.cause !== undefined) {\n payload.cause = summary.cause;\n }\n\n if (summary.errors !== undefined) {\n payload.errors = summary.errors;\n }\n\n // An ARRAY, not the newline-joined string `text` prints: a monitor can count and slice frames.\n if (summary.stack !== undefined) {\n payload.stack = summary.stack.split('\\n').map((frame) => frame.trim());\n }\n\n return this.safeStringify(payload);\n }\n\n private static renderText(opts: {\n summary: IErrorSummary;\n messageCode?: string;\n extra?: Record<string, unknown>;\n inspectOptions: util.InspectOptions;\n }): string {\n const { summary, messageCode, extra, inspectOptions } = opts;\n\n const lines: Array<string> = [];\n\n // What happened, then why, then who/where - a reader stops as soon as they have the answer.\n if (summary.message !== undefined) {\n lines.push(`message: ${summary.message}`);\n }\n\n // Straight after the message: the reader is looking at `%{field}` and needs the value now, not below the stack.\n if (summary.args !== undefined) {\n lines.push(`args: ${util.inspect(redactSecrets(summary.args), inspectOptions)}`);\n }\n\n this.pushAggregatedErrors({ node: summary, lines });\n\n let cause = summary.cause;\n while (cause !== undefined) {\n const causeCode = cause.code ?? cause.messageCode;\n const code = causeCode === undefined ? '' : ` (code ${causeCode})`;\n lines.push(`cause: ${cause.message ?? ''}${code}`);\n this.pushDiagnostics({ node: cause, lines });\n this.pushAggregatedErrors({ node: cause, lines });\n cause = cause.cause;\n }\n\n const identity = [summary.name, summary.code === undefined ? '' : `(code ${summary.code})`]\n .filter(Boolean)\n .join(' ');\n\n // A bare `name: Error` says nothing; keep the line only when it is specific or carries a code.\n if (identity !== '' && identity !== 'Error') {\n lines.push(`name: ${identity}`);\n }\n\n // The caller's code wins; otherwise the error's own, so a direct log call keeps its identifier too.\n const code =\n messageCode !== undefined && messageCode !== '' ? messageCode : summary.messageCode;\n if (code !== undefined) {\n lines.push(`code: ${code}`);\n }\n\n this.pushDiagnostics({ node: summary, lines });\n\n // An explicit `extra` wins; otherwise fall back to the one the error carries itself.\n const context = extra ?? summary.extra;\n\n if (context !== undefined && Object.keys(context).length > 0) {\n lines.push(`extra: ${util.inspect(redactSecrets(context), inspectOptions)}`);\n }\n\n if (summary.stack !== undefined) {\n lines.push(`stack:\\n${summary.stack}`);\n }\n\n return lines.map((line) => `- ${line}`).join('\\n');\n }\n\n /** Renders {@link summarize}. `text` returns a block whose newlines survive `%s`; `json` returns one line. */\n static format(opts: {\n error: unknown;\n messageCode?: string;\n extra?: Record<string, unknown>;\n includeStack?: boolean;\n maxStackFrames?: number;\n format?: TLoggerFormat;\n inspectOptions?: util.InspectOptions;\n }): string {\n const {\n error,\n messageCode,\n extra,\n includeStack = true,\n maxStackFrames,\n format,\n inspectOptions = this.INSPECT_OPTIONS,\n } = opts;\n\n const summary = this.summarize({ error, includeStack, maxStackFrames });\n\n if (this.resolveFormat(format) === LoggerFormats.JSON) {\n return this.renderJson({ summary, messageCode, extra });\n }\n\n return this.renderText({ summary, messageCode, extra, inspectOptions });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"error-prettier.js","sourceRoot":"","sources":["../../../../../src/modules/logger/formatting/error-prettier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAsB,MAAM,WAAW,CAAC;AAyB9D,yGAAyG;AACzG,MAAM,OAAO,aAAa;IACxB,qDAAqD;aACrC,4BAAuB,GAAG,CAAC,CAAC;IAE5C,kGAAkG;aAClF,6BAAwB,GAAG,EAAE,CAAC;IAE9C,iGAAiG;aACzE,oBAAe,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,CAAU,CAAC;IAE7F,yEAAyE;aACjD,kBAAa,GAAG,SAAS,CAAC;IAElD,4FAA4F;aACpE,6BAAwB,GAAG,mBAAmB,CAAC;IAEvE,8SAA8S;aACtR,gCAA2B,GACjD,iDAAiD,CAAC;IAEpD,uEAAuE;aAC/C,mBAAc,GAAG,EAAE,CAAC;IAE5C,+EAA+E;aACvD,0BAAqB,GAAG,EAAE,CAAC;aAE3B,oBAAe,GAAwB;QAC7D,KAAK,EAAE,CAAC;QACR,cAAc,EAAE,IAAI;QACpB,eAAe,EAAE,IAAI;QACrB,WAAW,EAAE,QAAQ;KACtB,CAAC;IAEM,MAAM,CAAC,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AE,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC,CAAC;QAExE,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,aAAa,CAAC,IAAI,EAAE,CAAC;YACtD,OAAO,IAAI,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;QAC1D,CAAC;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC;IAC1E,CAAC","sourcesContent":["import { RedactUtility } from '@/common/redact';\nimport { MessageCode } from '@/modules/error';\nimport util from 'node:util';\nimport { LoggerFormats, type TLoggerFormat } from '../common';\n\n/** Useful-only projection of an error: a driver's `query`/`params` repeat the message and are dropped. */\nexport interface IErrorSummary {\n name?: string;\n message?: string;\n /** The error's OWN code - a driver's `23505`, a gRPC `14`. Belongs with the name, not with the message. */\n code?: string | number;\n /** An `ApplicationError`'s `normalized.code` - the identifier an application filters on. `MessageCode.DEFAULT` never surfaces. */\n messageCode?: string;\n /** Frames ONLY - V8's `Error: <message>` header is stripped so the message is not repeated. */\n stack?: string;\n hint?: string;\n detail?: string;\n table?: string;\n constraint?: string;\n /** Values for the `%{placeholder}` tokens left unresolved in `message` - i18n resolves them downstream, so the log must carry them or the message names no field. */\n args?: Record<string, unknown>;\n /** An `ApplicationError`'s caller context - the one unmodelled payload worth keeping. */\n extra?: Record<string, unknown>;\n cause?: IErrorSummary;\n /** Every reason an `AggregateError` collected. Its own message names none of them, so without this the log says only that something failed. */\n errors?: Array<IErrorSummary>;\n}\n\n/** Turns a thrown value into something a human can read in a console - log this, never the raw error. */\nexport class ErrorPrettier {\n /** Bounds a pathological or cyclic `cause` chain. */\n static readonly DEFAULT_MAX_CAUSE_DEPTH = 5;\n\n /** The throw site is near the top; the tail is identical framework plumbing for every request. */\n static readonly DEFAULT_MAX_STACK_FRAMES = 10;\n\n /** Driver diagnostics that are actionable and absent from `message` - `pg` supplies all four. */\n private static readonly DIAGNOSTIC_KEYS = ['hint', 'detail', 'table', 'constraint'] as const;\n\n /** A stack frame line in every V8 stack: ` at fn (file:line:col)`. */\n private static readonly FRAME_PATTERN = /^\\s+at /;\n\n /** A frame inside an installed package - `node_modules/` covers bun's `.bun/` store too. */\n private static readonly DEPENDENCY_FRAME_PATTERN = /node_modules[/\\\\]/;\n\n /** `getError` sits on top of every `ApplicationError` stack and names no call site. Installed, it is also the FIRST dependency frame, so the keep-the-first rule would preserve exactly the wrong one. Anchored on `inversion` so an application's own `modules/error/app-error` is not swallowed with it. */\n private static readonly ERROR_FACTORY_FRAME_PATTERN =\n /inversion[/\\\\].*modules[/\\\\]error[/\\\\]app-error/;\n\n /** Issues rendered from a ZodError before the rest are counted off. */\n private static readonly MAX_ZOD_ISSUES = 10;\n\n /** Members of an `AggregateError` rendered before the rest are counted off. */\n private static readonly MAX_AGGREGATED_ERRORS = 10;\n\n private static readonly INSPECT_OPTIONS: util.InspectOptions = {\n depth: 5,\n maxArrayLength: null,\n maxStringLength: null,\n breakLength: Infinity,\n };\n\n private static extractFrames(opts: { stack: unknown; maxFrames: number }): string | undefined {\n const { stack, maxFrames } = opts;\n\n if (typeof stack !== 'string') {\n return undefined;\n }\n\n const frames: Array<string> = [];\n let keptDependencyFrame = false;\n let omitted = 0;\n\n // Hand-rolled over split+filter+slice: it stops at maxFrames instead of walking the whole stack.\n const lines = stack.split('\\n');\n for (const line of lines) {\n if (!this.FRAME_PATTERN.test(line)) {\n continue;\n }\n\n // Not counted as omitted: a factory frame is noise, and reporting it would imply signal was dropped.\n if (this.ERROR_FACTORY_FRAME_PATTERN.test(line)) {\n continue;\n }\n\n // The FIRST dependency frame is often the throw site (drizzle, jose); every later one is plumbing.\n const isDependencyFrame = this.DEPENDENCY_FRAME_PATTERN.test(line);\n\n if (isDependencyFrame && keptDependencyFrame) {\n omitted += 1;\n continue;\n }\n\n keptDependencyFrame = keptDependencyFrame || isDependencyFrame;\n frames.push(line);\n\n if (frames.length === maxFrames) {\n break;\n }\n }\n\n // Emit nothing rather than the header, which would repeat the message.\n if (frames.length === 0) {\n return undefined;\n }\n\n // Never truncate silently - a reader must know frames are missing, not assume the stack ended.\n return omitted > 0\n ? `${frames.join('\\n')}\\n ... ${omitted} dependency frames`\n : frames.join('\\n');\n }\n\n /** A ZodError's `message` is its issue array as pretty JSON - dozens of lines for one bad field. Render `path: reason` instead. */\n private static compressZodMessage(opts: { message: string }): string {\n const { message } = opts;\n\n let issues: unknown;\n\n try {\n issues = JSON.parse(message);\n } catch {\n // Not the JSON form (an already-formatted or hand-built ZodError) - leave it alone.\n return message;\n }\n\n if (!Array.isArray(issues) || issues.length === 0) {\n return message;\n }\n\n const lines = issues.slice(0, this.MAX_ZOD_ISSUES).map((issue) => {\n const entry = issue as { path?: Array<string | number>; message?: string; code?: string };\n const path =\n Array.isArray(entry.path) && entry.path.length > 0 ? entry.path.join('.') : '(root)';\n\n return `${path}: ${entry.message ?? entry.code ?? 'invalid'}`;\n });\n\n const remaining = issues.length - lines.length;\n\n return remaining > 0 ? `${lines.join('\\n')}\\n... and ${remaining} more` : lines.join('\\n');\n }\n\n private static summarizeNode(opts: {\n value: unknown;\n depthLeft: number;\n seen: WeakSet<object>;\n isRoot: boolean;\n includeStack: boolean;\n maxStackFrames: number;\n }): IErrorSummary {\n const { value, depthLeft, seen, isRoot, includeStack, maxStackFrames } = opts;\n\n // A primitive - a string thrown as `cause`, a numeric code - is its own message.\n if (typeof value !== 'object' || value === null) {\n return { message: String(value) };\n }\n\n if (seen.has(value)) {\n return { message: '[Circular]' };\n }\n seen.add(value);\n\n const source = value as Record<string, unknown>;\n const summary: IErrorSummary = {};\n\n if (typeof source.name === 'string') {\n summary.name = source.name;\n }\n\n if (typeof source.message === 'string') {\n summary.message =\n source.name === 'ZodError'\n ? this.compressZodMessage({ message: source.message })\n : source.message;\n }\n\n if (typeof source.code === 'string' || typeof source.code === 'number') {\n summary.code = source.code;\n }\n\n const normalized =\n typeof source.normalized === 'object' && source.normalized !== null\n ? (source.normalized as { code?: unknown; args?: unknown })\n : undefined;\n\n // `MessageCode.resolve` stamps DEFAULT on every codeless error, so surfacing it blindly would put a meaningless line on every log.\n if (typeof normalized?.code === 'string' && normalized.code !== MessageCode.DEFAULT) {\n summary.messageCode = normalized.code;\n }\n\n // Root only: a cause's frames point into the same libraries and add no location the root lacks.\n if (isRoot && includeStack) {\n const frames = this.extractFrames({ stack: source.stack, maxFrames: maxStackFrames });\n if (frames !== undefined) {\n summary.stack = frames;\n }\n }\n\n for (const key of this.DIAGNOSTIC_KEYS) {\n const diagnostic = source[key];\n if (typeof diagnostic === 'string' && diagnostic.length > 0) {\n summary[key] = diagnostic;\n }\n }\n\n // Root only: the args fill the ROOT's message; a cause's belong to a message this block does not print.\n if (isRoot && typeof normalized?.args === 'object' && normalized.args !== null) {\n const args = normalized.args as Record<string, unknown>;\n if (Object.keys(args).length > 0) {\n summary.args = args;\n }\n }\n\n // Root only: `extra` is what a throw site deliberately attached, so a direct log call keeps it.\n if (isRoot && typeof source.extra === 'object' && source.extra !== null) {\n const extra = source.extra as Record<string, unknown>;\n if (Object.keys(extra).length > 0) {\n summary.extra = extra;\n }\n }\n\n if (source.cause !== undefined && source.cause !== null && depthLeft > 0) {\n summary.cause = this.summarizeNode({\n value: source.cause,\n depthLeft: depthLeft - 1,\n seen,\n isRoot: false,\n includeStack,\n maxStackFrames,\n });\n }\n\n // A protocol client reports one member per thing that failed; the wrapper carries only a generic sentence.\n if (Array.isArray(source.errors) && source.errors.length > 0 && depthLeft > 0) {\n const members = source.errors.slice(0, this.MAX_AGGREGATED_ERRORS).map((member) =>\n this.summarizeNode({\n value: member,\n depthLeft: depthLeft - 1,\n seen,\n isRoot: false,\n includeStack,\n maxStackFrames,\n }),\n );\n\n const remaining = source.errors.length - members.length;\n if (remaining > 0) {\n members.push({ message: `... and ${remaining} more` });\n }\n\n summary.errors = members;\n }\n\n // Nothing recognizable: inspect it (redacted) so an unmodelled shape still reaches the log.\n if (Object.keys(summary).length === 0) {\n return {\n message: util.inspect(RedactUtility.redactSecrets({ value }), this.INSPECT_OPTIONS),\n };\n }\n\n return summary;\n }\n\n private static pushDiagnostics(opts: { node: IErrorSummary; lines: Array<string> }): void {\n const { node, lines } = opts;\n\n for (const key of this.DIAGNOSTIC_KEYS) {\n const diagnostic = node[key];\n if (diagnostic !== undefined) {\n lines.push(`${key}: ${diagnostic}`);\n }\n }\n }\n\n /** Under whichever node collected them - a wrapped `AggregateError` is the common shape. */\n private static pushAggregatedErrors(opts: { node: IErrorSummary; lines: Array<string> }): void {\n const { node, lines } = opts;\n\n node.errors?.forEach((member, index) => {\n const memberCode = member.code ?? member.messageCode;\n const code = memberCode === undefined ? '' : ` (code ${memberCode})`;\n lines.push(`errors[${index}]: ${member.message ?? ''}${code}`);\n this.pushDiagnostics({ node: member, lines });\n });\n }\n\n /** Reduces any thrown value to {@link IErrorSummary} - always a summary, never a bare primitive. */\n static summarize(opts: {\n error: unknown;\n includeStack?: boolean;\n maxCauseDepth?: number;\n maxStackFrames?: number;\n }): IErrorSummary {\n const {\n error,\n includeStack = true,\n maxCauseDepth = this.DEFAULT_MAX_CAUSE_DEPTH,\n maxStackFrames = this.DEFAULT_MAX_STACK_FRAMES,\n } = opts;\n\n return this.summarizeNode({\n value: error,\n depthLeft: maxCauseDepth,\n seen: new WeakSet(),\n isRoot: true,\n includeStack,\n maxStackFrames,\n });\n }\n\n /** Resolved per call, not at module load, so a test passes a value instead of mutating the environment. */\n private static resolveFormat(configured?: TLoggerFormat): TLoggerFormat {\n if (configured !== undefined) {\n return configured;\n }\n\n const fromEnv = process.env.APP_ENV_LOGGER_FORMAT;\n\n return fromEnv !== undefined && LoggerFormats.isValid(fromEnv) ? fromEnv : LoggerFormats.TEXT;\n }\n\n /** `JSON.stringify` throws on a cycle, and `format` runs inside the error handler - a throw there turns a handled failure into an unhandled one. `redactSecrets` breaks cycles on its own, but it is switched off by `APP_ENV_LOGGER_DO_REDACT=false`, so structural safety cannot lean on it. A repeated reference reads as `[Circular]` too: the first occurrence still carries the data. */\n private static safeStringify(payload: Record<string, unknown>): string {\n const seen = new WeakSet<object>();\n\n return JSON.stringify(payload, (_key, value: unknown) => {\n if (typeof value !== 'object' || value === null) {\n return value;\n }\n\n if (seen.has(value)) {\n return '[Circular]';\n }\n\n seen.add(value);\n return value;\n });\n }\n\n /** One line, so a log monitor keeps the error as ONE record instead of one per bullet. */\n private static renderJson(opts: {\n summary: IErrorSummary;\n messageCode?: string;\n extra?: Record<string, unknown>;\n }): string {\n const { summary, messageCode, extra } = opts;\n\n const payload: Record<string, unknown> = {};\n\n if (summary.message !== undefined) {\n payload.message = summary.message;\n }\n\n if (summary.args !== undefined) {\n payload.args = RedactUtility.redactSecrets({ value: summary.args });\n }\n\n // An ApplicationError has no own `code` and a driver error has no `normalized`, so one field never hides the other.\n const code =\n messageCode !== undefined && messageCode !== ''\n ? messageCode\n : (summary.messageCode ?? summary.code);\n if (code !== undefined) {\n payload.code = code;\n }\n\n // A bare `Error` says nothing; the text block drops it for the same reason.\n if (summary.name !== undefined && summary.name !== 'Error') {\n payload.name = summary.name;\n }\n\n for (const key of this.DIAGNOSTIC_KEYS) {\n if (summary[key] !== undefined) {\n payload[key] = summary[key];\n }\n }\n\n const context = extra ?? summary.extra;\n if (context !== undefined && Object.keys(context).length > 0) {\n payload.extra = RedactUtility.redactSecrets({ value: context });\n }\n\n if (summary.cause !== undefined) {\n payload.cause = summary.cause;\n }\n\n if (summary.errors !== undefined) {\n payload.errors = summary.errors;\n }\n\n // An ARRAY, not the newline-joined string `text` prints: a monitor can count and slice frames.\n if (summary.stack !== undefined) {\n payload.stack = summary.stack.split('\\n').map((frame) => frame.trim());\n }\n\n return this.safeStringify(payload);\n }\n\n private static renderText(opts: {\n summary: IErrorSummary;\n messageCode?: string;\n extra?: Record<string, unknown>;\n inspectOptions: util.InspectOptions;\n }): string {\n const { summary, messageCode, extra, inspectOptions } = opts;\n\n const lines: Array<string> = [];\n\n // What happened, then why, then who/where - a reader stops as soon as they have the answer.\n if (summary.message !== undefined) {\n lines.push(`message: ${summary.message}`);\n }\n\n // Straight after the message: the reader is looking at `%{field}` and needs the value now, not below the stack.\n if (summary.args !== undefined) {\n lines.push(\n `args: ${util.inspect(RedactUtility.redactSecrets({ value: summary.args }), inspectOptions)}`,\n );\n }\n\n this.pushAggregatedErrors({ node: summary, lines });\n\n let cause = summary.cause;\n while (cause !== undefined) {\n const causeCode = cause.code ?? cause.messageCode;\n const code = causeCode === undefined ? '' : ` (code ${causeCode})`;\n lines.push(`cause: ${cause.message ?? ''}${code}`);\n this.pushDiagnostics({ node: cause, lines });\n this.pushAggregatedErrors({ node: cause, lines });\n cause = cause.cause;\n }\n\n const identity = [summary.name, summary.code === undefined ? '' : `(code ${summary.code})`]\n .filter(Boolean)\n .join(' ');\n\n // A bare `name: Error` says nothing; keep the line only when it is specific or carries a code.\n if (identity !== '' && identity !== 'Error') {\n lines.push(`name: ${identity}`);\n }\n\n // The caller's code wins; otherwise the error's own, so a direct log call keeps its identifier too.\n const code =\n messageCode !== undefined && messageCode !== '' ? messageCode : summary.messageCode;\n if (code !== undefined) {\n lines.push(`code: ${code}`);\n }\n\n this.pushDiagnostics({ node: summary, lines });\n\n // An explicit `extra` wins; otherwise fall back to the one the error carries itself.\n const context = extra ?? summary.extra;\n\n if (context !== undefined && Object.keys(context).length > 0) {\n lines.push(\n `extra: ${util.inspect(RedactUtility.redactSecrets({ value: context }), inspectOptions)}`,\n );\n }\n\n if (summary.stack !== undefined) {\n lines.push(`stack:\\n${summary.stack}`);\n }\n\n return lines.map((line) => `- ${line}`).join('\\n');\n }\n\n /** Renders {@link summarize}. `text` returns a block whose newlines survive `%s`; `json` returns one line. */\n static format(opts: {\n error: unknown;\n messageCode?: string;\n extra?: Record<string, unknown>;\n includeStack?: boolean;\n maxStackFrames?: number;\n format?: TLoggerFormat;\n inspectOptions?: util.InspectOptions;\n }): string {\n const {\n error,\n messageCode,\n extra,\n includeStack = true,\n maxStackFrames,\n format,\n inspectOptions = this.INSPECT_OPTIONS,\n } = opts;\n\n const summary = this.summarize({ error, includeStack, maxStackFrames });\n\n if (this.resolveFormat(format) === LoggerFormats.JSON) {\n return this.renderJson({ summary, messageCode, extra });\n }\n\n return this.renderText({ summary, messageCode, extra, inspectOptions });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../../src/modules/logger/hf/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,KAAK,OAAO,
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../../src/modules/logger/hf/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,KAAK,OAAO,EAA8B,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAkBrF,4KAA4K;AAC5K,qBAAa,QAAS,SAAQ,cAAc;IAC1C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAqB;IACxD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAiC;IACnE,OAAO,CAAC,MAAM,CAAC,KAAK,CAA+B;IACnD,OAAO,CAAC,MAAM,CAAC,YAAY,CAAiC;IAE5D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IAErC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;IAElC,OAAO;IAQP,OAAO,CAAC,MAAM,CAAC,WAAW;IAS1B,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ;IASnC,6HAA6H;IAC7H,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU;IAcjD,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAQjC,OAAO,CAAC,UAAU;IAoBlB,OAAO,CAAC,WAAW;IAYnB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAOhD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAI/C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAI/C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAIhD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAIhD,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAChE,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,GAAG,IAAI;IAerD,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;CAGjC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractLogger } from '../base/index.js';
|
|
2
|
-
import { LogLevels,
|
|
3
|
-
import {
|
|
2
|
+
import { LogLevels, LoggerDebugGate } from '../common/index.js';
|
|
3
|
+
import { LogFormatUtility } from '../formatting/index.js';
|
|
4
4
|
import { BUFFER_SIZE, ENTRY_SIZE, HF_LEVEL_CODES, HF_MESSAGE_MAX_BYTES, HF_SCOPE_MAX_BYTES, MESSAGE_CACHE_CAP, OFFSET_LEVEL, OFFSET_MESSAGE, OFFSET_MESSAGE_LENGTH, OFFSET_SCOPE, OFFSET_SCOPE_LENGTH, } from './common/index.js';
|
|
5
5
|
import { HfLogRing } from './ring.js';
|
|
6
6
|
/** Ring-buffer logger for hot paths; extends AbstractLogger, NOT BaseLogger - BaseLogger's string-sink plumbing is exactly the cost this implementation exists to avoid. */
|
|
@@ -70,13 +70,13 @@ export class HfLogger extends AbstractLogger {
|
|
|
70
70
|
writeString(levelCode, message, args) {
|
|
71
71
|
if (args.length > 0) {
|
|
72
72
|
// Slow path, documented: args are formatted (deep inspection + redaction) - never dropped.
|
|
73
|
-
this.writeEntry(levelCode, HfLogger.textEncoder.encode(
|
|
73
|
+
this.writeEntry(levelCode, HfLogger.textEncoder.encode(LogFormatUtility.formatMessage({ message, args })));
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
this.writeEntry(levelCode, HfLogger.encodeMessage(message));
|
|
77
77
|
}
|
|
78
78
|
debug(message, ...args) {
|
|
79
|
-
if (!
|
|
79
|
+
if (!LoggerDebugGate.isOpen()) {
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
this.writeString(HF_LEVEL_CODES.debug, message, args);
|
|
@@ -94,7 +94,7 @@ export class HfLogger extends AbstractLogger {
|
|
|
94
94
|
this.writeString(HF_LEVEL_CODES.emerg, message, args);
|
|
95
95
|
}
|
|
96
96
|
log(level, message, ...args) {
|
|
97
|
-
if (level === LogLevels.DEBUG && !
|
|
97
|
+
if (level === LogLevels.DEBUG && !LoggerDebugGate.isOpen()) {
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
const levelCode = Object.hasOwn(HF_LEVEL_CODES, level)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../../../src/modules/logger/hf/logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAgB,SAAS,EAAE,gBAAgB,EAAkB,MAAM,WAAW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,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,GAAG,CAAC,UAAkB;QACpB,OAAO,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,UAAU,EAAE,CAAC,CAAC;IACrD,CAAC","sourcesContent":["import { type AnyType } from '@/common/types';\nimport { AbstractLogger } from '../base';\nimport { type ILogger, LogLevels, SHOULD_LOG_DEBUG, type TLogLevel } from '../common';\nimport { formatLogMessage } from '../formatting';\nimport {\n BUFFER_SIZE,\n ENTRY_SIZE,\n HF_LEVEL_CODES,\n HF_MESSAGE_MAX_BYTES,\n HF_SCOPE_MAX_BYTES,\n MESSAGE_CACHE_CAP,\n OFFSET_LEVEL,\n OFFSET_MESSAGE,\n OFFSET_MESSAGE_LENGTH,\n OFFSET_SCOPE,\n OFFSET_SCOPE_LENGTH,\n type TRingState,\n} from './common';\nimport { HfLogRing } from './ring';\n\n/** Ring-buffer logger for hot paths; extends AbstractLogger, NOT BaseLogger - BaseLogger's string-sink plumbing is exactly the cost this implementation exists to avoid. */\nexport class HfLogger extends AbstractLogger {\n private static readonly textEncoder = new TextEncoder();\n private static readonly scopeCache = new Map<string, Uint8Array>();\n private static cache = new Map<string, HfLogger>();\n private static messageCache = new Map<string, Uint8Array>();\n\n private readonly scope: string;\n private readonly scopeBytes: Uint8Array;\n private readonly scopeLength: number;\n // Resolved once at construction (get() has already allocated the ring): saves a call and a null-check per log on a path budgeted in nanoseconds.\n private readonly ring: TRingState;\n\n private constructor(scope: string) {\n super();\n this.scope = scope;\n this.scopeBytes = HfLogger.encodeScope(scope);\n this.scopeLength = this.scopeBytes.length;\n this.ring = HfLogRing.get();\n }\n\n private static encodeScope(scope: string): Uint8Array {\n let bytes = HfLogger.scopeCache.get(scope);\n if (!bytes) {\n bytes = HfLogger.textEncoder.encode(scope).subarray(0, HF_SCOPE_MAX_BYTES);\n HfLogger.scopeCache.set(scope, bytes);\n }\n return bytes;\n }\n\n static get(scope: string): HfLogger {\n let logger = this.cache.get(scope);\n if (!logger) {\n logger = new HfLogger(scope); // first logger allocates the ring - never at import\n this.cache.set(scope, logger);\n }\n return logger;\n }\n\n /** Pre-encode a message at initialization time; the cache is FIFO-bounded so dynamic strings can't grow it without limit. */\n static encodeMessage(message: string): Uint8Array {\n const cached = this.messageCache.get(message);\n if (cached) {\n return cached;\n }\n\n const bytes = HfLogger.textEncoder.encode(message);\n if (this.messageCache.size >= MESSAGE_CACHE_CAP) {\n this.evictOldestMessage();\n }\n this.messageCache.set(message, bytes);\n return bytes;\n }\n\n private static evictOldestMessage(): void {\n const oldest = this.messageCache.keys().next().value;\n if (oldest === undefined) {\n return;\n }\n this.messageCache.delete(oldest);\n }\n\n private writeEntry(levelCode: number, messageBytes: Uint8Array): void {\n const ring = this.ring;\n const slot = ring.writeIndex++ & (BUFFER_SIZE - 1);\n const offset = slot * ENTRY_SIZE;\n ring.f64[offset >> 3] = performance.timeOrigin + performance.now();\n const bytes = ring.bytes;\n bytes[offset + OFFSET_LEVEL] = levelCode;\n bytes[offset + OFFSET_SCOPE_LENGTH] = this.scopeLength;\n bytes.set(this.scopeBytes, offset + OFFSET_SCOPE);\n const messageLength =\n messageBytes.length < HF_MESSAGE_MAX_BYTES ? messageBytes.length : HF_MESSAGE_MAX_BYTES;\n bytes[offset + OFFSET_MESSAGE_LENGTH] = messageLength;\n bytes.set(\n messageLength === messageBytes.length\n ? messageBytes\n : messageBytes.subarray(0, messageLength),\n offset + OFFSET_MESSAGE,\n );\n }\n\n private writeString(levelCode: number, message: string, args: Array<AnyType>): void {\n if (args.length > 0) {\n // Slow path, documented: args are formatted (deep inspection + redaction) - never dropped.\n this.writeEntry(levelCode, HfLogger.textEncoder.encode(formatLogMessage({ message, args })));\n return;\n }\n this.writeEntry(levelCode, HfLogger.encodeMessage(message));\n }\n\n debug(message: string, ...args: AnyType[]): void {\n if (!SHOULD_LOG_DEBUG) {\n return;\n }\n this.writeString(HF_LEVEL_CODES.debug, message, args);\n }\n\n info(message: string, ...args: AnyType[]): void {\n this.writeString(HF_LEVEL_CODES.info, message, args);\n }\n\n warn(message: string, ...args: AnyType[]): void {\n this.writeString(HF_LEVEL_CODES.warn, message, args);\n }\n\n error(message: string, ...args: AnyType[]): void {\n this.writeString(HF_LEVEL_CODES.error, message, args);\n }\n\n emerg(message: string, ...args: AnyType[]): void {\n this.writeString(HF_LEVEL_CODES.emerg, message, args);\n }\n\n log(level: TLogLevel, message: string, ...args: AnyType[]): void;\n log(level: TLogLevel, messageBytes: Uint8Array): void;\n log(level: TLogLevel, message: string | Uint8Array, ...args: AnyType[]): void {\n if (level === LogLevels.DEBUG && !SHOULD_LOG_DEBUG) {\n return;\n }\n const levelCode = Object.hasOwn(HF_LEVEL_CODES, level)\n ? HF_LEVEL_CODES[level]\n : HF_LEVEL_CODES.info;\n if (typeof message === 'string') {\n this.writeString(levelCode, message, args);\n return;\n }\n this.writeEntry(levelCode, message);\n }\n\n for(methodName: string): ILogger {\n return HfLogger.get(`${this.scope}-${methodName}`);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../../../src/modules/logger/hf/logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAgB,SAAS,EAAE,eAAe,EAAkB,MAAM,WAAW,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EACL,WAAW,EACX,UAAU,EACV,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,mBAAmB,GAEpB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,4KAA4K;AAC5K,MAAM,OAAO,QAAS,SAAQ,cAAc;aAClB,gBAAW,GAAG,IAAI,WAAW,EAAE,CAAC;aAChC,eAAU,GAAG,IAAI,GAA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AI,CAAC,WAAW,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,GAAG,IAAe;QACvC,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,GAAG,IAAe;QACvC,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;IAID,GAAG,CAAC,KAAgB,EAAE,OAA4B,EAAE,GAAG,IAAe;QACpE,IAAI,KAAK,KAAK,SAAS,CAAC,KAAK,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,EAAE,CAAC;YAC3D,OAAO;QACT,CAAC;QACD,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,KAAK,CAAC;YACpD,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC;YACvB,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC;QACxB,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;YAC3C,OAAO;QACT,CAAC;QACD,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,GAAG,CAAC,UAAkB;QACpB,OAAO,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,UAAU,EAAE,CAAC,CAAC;IACrD,CAAC","sourcesContent":["import { type AnyType } from '@/common/types';\nimport { AbstractLogger } from '../base';\nimport { type ILogger, LogLevels, LoggerDebugGate, type TLogLevel } from '../common';\nimport { LogFormatUtility } from '../formatting';\nimport {\n BUFFER_SIZE,\n ENTRY_SIZE,\n HF_LEVEL_CODES,\n HF_MESSAGE_MAX_BYTES,\n HF_SCOPE_MAX_BYTES,\n MESSAGE_CACHE_CAP,\n OFFSET_LEVEL,\n OFFSET_MESSAGE,\n OFFSET_MESSAGE_LENGTH,\n OFFSET_SCOPE,\n OFFSET_SCOPE_LENGTH,\n type TRingState,\n} from './common';\nimport { HfLogRing } from './ring';\n\n/** Ring-buffer logger for hot paths; extends AbstractLogger, NOT BaseLogger - BaseLogger's string-sink plumbing is exactly the cost this implementation exists to avoid. */\nexport class HfLogger extends AbstractLogger {\n private static readonly textEncoder = new TextEncoder();\n private static readonly scopeCache = new Map<string, Uint8Array>();\n private static cache = new Map<string, HfLogger>();\n private static messageCache = new Map<string, Uint8Array>();\n\n private readonly scope: string;\n private readonly scopeBytes: Uint8Array;\n private readonly scopeLength: number;\n // Resolved once at construction (get() has already allocated the ring): saves a call and a null-check per log on a path budgeted in nanoseconds.\n private readonly ring: TRingState;\n\n private constructor(scope: string) {\n super();\n this.scope = scope;\n this.scopeBytes = HfLogger.encodeScope(scope);\n this.scopeLength = this.scopeBytes.length;\n this.ring = HfLogRing.get();\n }\n\n private static encodeScope(scope: string): Uint8Array {\n let bytes = HfLogger.scopeCache.get(scope);\n if (!bytes) {\n bytes = HfLogger.textEncoder.encode(scope).subarray(0, HF_SCOPE_MAX_BYTES);\n HfLogger.scopeCache.set(scope, bytes);\n }\n return bytes;\n }\n\n static get(scope: string): HfLogger {\n let logger = this.cache.get(scope);\n if (!logger) {\n logger = new HfLogger(scope); // first logger allocates the ring - never at import\n this.cache.set(scope, logger);\n }\n return logger;\n }\n\n /** Pre-encode a message at initialization time; the cache is FIFO-bounded so dynamic strings can't grow it without limit. */\n static encodeMessage(message: string): Uint8Array {\n const cached = this.messageCache.get(message);\n if (cached) {\n return cached;\n }\n\n const bytes = HfLogger.textEncoder.encode(message);\n if (this.messageCache.size >= MESSAGE_CACHE_CAP) {\n this.evictOldestMessage();\n }\n this.messageCache.set(message, bytes);\n return bytes;\n }\n\n private static evictOldestMessage(): void {\n const oldest = this.messageCache.keys().next().value;\n if (oldest === undefined) {\n return;\n }\n this.messageCache.delete(oldest);\n }\n\n private writeEntry(levelCode: number, messageBytes: Uint8Array): void {\n const ring = this.ring;\n const slot = ring.writeIndex++ & (BUFFER_SIZE - 1);\n const offset = slot * ENTRY_SIZE;\n ring.f64[offset >> 3] = performance.timeOrigin + performance.now();\n const bytes = ring.bytes;\n bytes[offset + OFFSET_LEVEL] = levelCode;\n bytes[offset + OFFSET_SCOPE_LENGTH] = this.scopeLength;\n bytes.set(this.scopeBytes, offset + OFFSET_SCOPE);\n const messageLength =\n messageBytes.length < HF_MESSAGE_MAX_BYTES ? messageBytes.length : HF_MESSAGE_MAX_BYTES;\n bytes[offset + OFFSET_MESSAGE_LENGTH] = messageLength;\n bytes.set(\n messageLength === messageBytes.length\n ? messageBytes\n : messageBytes.subarray(0, messageLength),\n offset + OFFSET_MESSAGE,\n );\n }\n\n private writeString(levelCode: number, message: string, args: Array<AnyType>): void {\n if (args.length > 0) {\n // Slow path, documented: args are formatted (deep inspection + redaction) - never dropped.\n this.writeEntry(\n levelCode,\n HfLogger.textEncoder.encode(LogFormatUtility.formatMessage({ message, args })),\n );\n return;\n }\n this.writeEntry(levelCode, HfLogger.encodeMessage(message));\n }\n\n debug(message: string, ...args: AnyType[]): void {\n if (!LoggerDebugGate.isOpen()) {\n return;\n }\n this.writeString(HF_LEVEL_CODES.debug, message, args);\n }\n\n info(message: string, ...args: AnyType[]): void {\n this.writeString(HF_LEVEL_CODES.info, message, args);\n }\n\n warn(message: string, ...args: AnyType[]): void {\n this.writeString(HF_LEVEL_CODES.warn, message, args);\n }\n\n error(message: string, ...args: AnyType[]): void {\n this.writeString(HF_LEVEL_CODES.error, message, args);\n }\n\n emerg(message: string, ...args: AnyType[]): void {\n this.writeString(HF_LEVEL_CODES.emerg, message, args);\n }\n\n log(level: TLogLevel, message: string, ...args: AnyType[]): void;\n log(level: TLogLevel, messageBytes: Uint8Array): void;\n log(level: TLogLevel, message: string | Uint8Array, ...args: AnyType[]): void {\n if (level === LogLevels.DEBUG && !LoggerDebugGate.isOpen()) {\n return;\n }\n const levelCode = Object.hasOwn(HF_LEVEL_CODES, level)\n ? HF_LEVEL_CODES[level]\n : HF_LEVEL_CODES.info;\n if (typeof message === 'string') {\n this.writeString(levelCode, message, args);\n return;\n }\n this.writeEntry(levelCode, message);\n }\n\n for(methodName: string): ILogger {\n return HfLogger.get(`${this.scope}-${methodName}`);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/logger/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,MAAM,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/logger/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/logger/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,MAAM,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/logger/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,MAAM,CAAC","sourcesContent":["export * from './base';\nexport * from './common';\nexport * from './factory';\nexport * from './formatting';\nexport * from './hf';\n"]}
|
|
@@ -18,13 +18,4 @@ export declare class PinoBackingLogger {
|
|
|
18
18
|
}): void;
|
|
19
19
|
private static closeTransport;
|
|
20
20
|
}
|
|
21
|
-
export declare const buildPinoOptions: () => {
|
|
22
|
-
name: string;
|
|
23
|
-
level: import("../index.js").TLogLevel;
|
|
24
|
-
customLevels: Record<"emerg", number>;
|
|
25
|
-
};
|
|
26
|
-
export declare const getPinoBackingLogger: () => TPinoInstance;
|
|
27
|
-
export declare const setPinoBackingLogger: (opts: {
|
|
28
|
-
instance: TPinoInstance;
|
|
29
|
-
}) => void;
|
|
30
21
|
//# sourceMappingURL=backing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backing.d.ts","sourceRoot":"","sources":["../../../../../src/modules/logger/pino/backing.ts"],"names":[],"mappings":"AAKA,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAGlE,oGAAoG;AACpG,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA4B;IACnD,6NAA6N;IAC7N,OAAO,CAAC,MAAM,CAAC,SAAS,CAAqC;IAE7D,8KAA8K;IAC9K,MAAM,CAAC,YAAY;;;;;IAQnB,sQAAsQ;IACtQ,MAAM,CAAC,GAAG,IAAI,aAAa;IAY3B,4QAA4Q;IAC5Q,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,aAAa,CAAA;KAAE,GAAG,IAAI;IAUnD,OAAO,CAAC,MAAM,CAAC,cAAc;CAW9B
|
|
1
|
+
{"version":3,"file":"backing.d.ts","sourceRoot":"","sources":["../../../../../src/modules/logger/pino/backing.ts"],"names":[],"mappings":"AAKA,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAGlE,oGAAoG;AACpG,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA4B;IACnD,6NAA6N;IAC7N,OAAO,CAAC,MAAM,CAAC,SAAS,CAAqC;IAE7D,8KAA8K;IAC9K,MAAM,CAAC,YAAY;;;;;IAQnB,sQAAsQ;IACtQ,MAAM,CAAC,GAAG,IAAI,aAAa;IAY3B,4QAA4Q;IAC5Q,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,aAAa,CAAA;KAAE,GAAG,IAAI;IAUnD,OAAO,CAAC,MAAM,CAAC,cAAc;CAW9B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Defaults } from '../../../common/constants/index.js';
|
|
2
2
|
import pino from 'pino';
|
|
3
|
-
import {
|
|
3
|
+
import { LoggerConfigUtility } from '../common/index.js';
|
|
4
4
|
import { PINO_CUSTOM_LEVELS } from './common/index.js';
|
|
5
5
|
import { PinoDestination } from './destination.js';
|
|
6
6
|
/** Owns the single pino instance every scope writes through, and the transport thread behind it. */
|
|
@@ -9,14 +9,14 @@ export class PinoBackingLogger {
|
|
|
9
9
|
static buildOptions() {
|
|
10
10
|
return {
|
|
11
11
|
name: Defaults.APPLICATION_NAME,
|
|
12
|
-
level:
|
|
12
|
+
level: LoggerConfigUtility.resolveLevel({ configured: process.env.APP_ENV_LOGGER_LEVEL }),
|
|
13
13
|
customLevels: PINO_CUSTOM_LEVELS,
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
/** Lazy, env-driven singleton, built once and reused by every scope entirely synchronously - the very first log line already targets the real env-configured destination, no stdout bootstrap. `set()` is the only way to replace it; this getter never resets it. */
|
|
17
17
|
static get() {
|
|
18
18
|
if (!PinoBackingLogger.instance) {
|
|
19
|
-
const destination = PinoDestination.build(PinoDestination.resolvePlan());
|
|
19
|
+
const destination = PinoDestination.build({ plan: PinoDestination.resolvePlan() });
|
|
20
20
|
PinoBackingLogger.instance = pino(PinoBackingLogger.buildOptions(), destination);
|
|
21
21
|
PinoBackingLogger.transport = destination;
|
|
22
22
|
}
|
|
@@ -43,9 +43,4 @@ export class PinoBackingLogger {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
// Published names, kept so `@venizia/ignis-helpers/pino` consumers do not have to move; the class
|
|
47
|
-
// above is the implementation and the entry point for new code.
|
|
48
|
-
export const buildPinoOptions = () => PinoBackingLogger.buildOptions();
|
|
49
|
-
export const getPinoBackingLogger = () => PinoBackingLogger.get();
|
|
50
|
-
export const setPinoBackingLogger = (opts) => PinoBackingLogger.set(opts);
|
|
51
46
|
//# sourceMappingURL=backing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backing.js","sourceRoot":"","sources":["../../../../../src/modules/logger/pino/backing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"backing.js","sourceRoot":"","sources":["../../../../../src/modules/logger/pino/backing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAsB,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,oGAAoG;AACpG,MAAM,OAAO,iBAAiB;IAK5B,8KAA8K;IAC9K,MAAM,CAAC,YAAY;QACjB,OAAO;YACL,IAAI,EAAE,QAAQ,CAAC,gBAAgB;YAC/B,KAAK,EAAE,mBAAmB,CAAC,YAAY,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,CAAC;YACzF,YAAY,EAAE,kBAAkB;SACjC,CAAC;IACJ,CAAC;IAED,sQAAsQ;IACtQ,MAAM,CAAC,GAAG;QACR,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC;YAChC,MAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,eAAe,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YACnF,iBAAiB,CAAC,QAAQ,GAAG,IAAI,CAC/B,iBAAiB,CAAC,YAAY,EAAE,EAChC,WAAW,CACK,CAAC;YACnB,iBAAiB,CAAC,SAAS,GAAG,WAAW,CAAC;QAC5C,CAAC;QACD,OAAO,iBAAiB,CAAC,QAAQ,CAAC;IACpC,CAAC;IAED,4QAA4Q;IAC5Q,MAAM,CAAC,GAAG,CAAC,IAAiC;QAC1C,IAAI,iBAAiB,CAAC,QAAQ,EAAE,CAAC;YAC/B,iBAAiB,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;YACnC,iBAAiB,CAAC,cAAc,EAAE,CAAC;QACrC,CAAC;QAED,iBAAiB,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC3C,iBAAiB,CAAC,SAAS,GAAG,SAAS,CAAC;IAC1C,CAAC;IAEO,MAAM,CAAC,cAAc;QAC3B,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE,CAAC;YACjC,OAAO;QACT,CAAC;QAED,IAAI,CAAC;YACF,iBAAiB,CAAC,SAAqB,CAAC,GAAG,EAAE,CAAC;QACjD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,kEAAkE,EAAE,KAAK,CAAC,CAAC;QAC3F,CAAC;IACH,CAAC;CACF","sourcesContent":["import { Defaults } from '@/common/constants';\nimport { type AnyType } from '@/common/types';\nimport pino from 'pino';\nimport { LoggerConfigUtility } from '../common';\n\nimport { PINO_CUSTOM_LEVELS, type TPinoInstance } from './common';\nimport { PinoDestination } from './destination';\n\n/** Owns the single pino instance every scope writes through, and the transport thread behind it. */\nexport class PinoBackingLogger {\n private static instance: TPinoInstance | undefined;\n /** The `ThreadStream` behind `instance`, held ONLY when built via a transport (pretty/roll) and `undefined` for `stdout` or an injected instance - tracked so a replacement can close the worker instead of orphaning it. */\n private static transport: pino.DestinationStream | undefined;\n\n /** Pure: pino constructor options derived from env at CALL time. Public so tests can build a REAL instance against an in-memory destination, without the impure singleton. */\n static buildOptions() {\n return {\n name: Defaults.APPLICATION_NAME,\n level: LoggerConfigUtility.resolveLevel({ configured: process.env.APP_ENV_LOGGER_LEVEL }),\n customLevels: PINO_CUSTOM_LEVELS,\n };\n }\n\n /** Lazy, env-driven singleton, built once and reused by every scope entirely synchronously - the very first log line already targets the real env-configured destination, no stdout bootstrap. `set()` is the only way to replace it; this getter never resets it. */\n static get(): TPinoInstance {\n if (!PinoBackingLogger.instance) {\n const destination = PinoDestination.build({ plan: PinoDestination.resolvePlan() });\n PinoBackingLogger.instance = pino(\n PinoBackingLogger.buildOptions(),\n destination,\n ) as TPinoInstance;\n PinoBackingLogger.transport = destination;\n }\n return PinoBackingLogger.instance;\n }\n\n /** Replaces the singleton outright: an outgoing transport-backed instance (pretty/roll) is a `ThreadStream` on a live worker thread, so this flushes then `.end()`s it first rather than orphaning the worker; failures are logged via `console.error`, never swallowed. */\n static set(opts: { instance: TPinoInstance }): void {\n if (PinoBackingLogger.instance) {\n PinoBackingLogger.instance.flush();\n PinoBackingLogger.closeTransport();\n }\n\n PinoBackingLogger.instance = opts.instance;\n PinoBackingLogger.transport = undefined;\n }\n\n private static closeTransport(): void {\n if (!PinoBackingLogger.transport) {\n return;\n }\n\n try {\n (PinoBackingLogger.transport as AnyType).end();\n } catch (error) {\n console.error('[setPinoBackingLogger] Failed to close previous transport stream', error);\n }\n }\n}\n"]}
|
|
@@ -22,7 +22,9 @@ export declare class PinoDestination {
|
|
|
22
22
|
private static readonly DEFAULT_FREQUENCY;
|
|
23
23
|
private static readonly DEFAULT_MAX_FILES;
|
|
24
24
|
/** `APP_ENV_LOGGER_FILE_FREQUENCY` -> pino-roll's `frequency`; an unrecognized value warns and falls back rather than throwing, so the app still boots. */
|
|
25
|
-
static mapFrequency(
|
|
25
|
+
static mapFrequency(opts: {
|
|
26
|
+
value?: string;
|
|
27
|
+
}): TFrequency;
|
|
26
28
|
/** `null` means "not a recognized shape" - the caller decides what default to fall back to. */
|
|
27
29
|
private static parseMaxFilesValue;
|
|
28
30
|
/** `APP_ENV_LOGGER_FILE_MAX_FILES` -> pino-roll's `limit.count`: `'<n>d'` scales by frequency (hourly: days*24), a bare integer is a literal count, unrecognized falls back to `'5d'`. */
|
|
@@ -33,13 +35,8 @@ export declare class PinoDestination {
|
|
|
33
35
|
/** Pure: which destination pino should write to, derived from `APP_ENV_LOGGER_*` at CALL time. `DATE_PATTERN` is deliberately not read - pino-roll has no equivalent. */
|
|
34
36
|
static resolvePlan(): TDestinationPlan;
|
|
35
37
|
/** `pino.transport()` is SYNCHRONOUS - it returns a `ThreadStream` that BUFFERS writes until its worker thread loads, so no async gating is needed; `ModuleUtility.assertInstalled` runs first so a missing optional peer fails loudly here, not as an opaque worker-thread crash. */
|
|
36
|
-
static build(
|
|
38
|
+
static build(opts: {
|
|
39
|
+
plan: TDestinationPlan;
|
|
40
|
+
}): pino.DestinationStream | undefined;
|
|
37
41
|
}
|
|
38
|
-
export declare const mapFrequency: (value?: string) => TFrequency;
|
|
39
|
-
export declare const mapMaxFilesToCount: (opts: {
|
|
40
|
-
value?: string;
|
|
41
|
-
frequency: TFrequency;
|
|
42
|
-
}) => number;
|
|
43
|
-
export declare const resolveDestinationPlan: () => TDestinationPlan;
|
|
44
|
-
export declare const buildDestination: (plan: TDestinationPlan) => pino.DestinationStream | undefined;
|
|
45
42
|
//# sourceMappingURL=destination.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"destination.d.ts","sourceRoot":"","sources":["../../../../../src/modules/logger/pino/destination.ts"],"names":[],"mappings":"AAIA,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAE5D,mIAAmI;AACnI,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,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M,CAAC,QAAQ,CAAC,iBAAiB,CAAQ;IAEjD,2JAA2J;IAC3J,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,UAAU;IAuBzD,+FAA+F;IAC/F,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAejC,0LAA0L;IAC1L,MAAM,CAAC,kBAAkB,CAAC,IAAI,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,UAAU,CAAA;KAAE,GAAG,MAAM;IA0BlF,yKAAyK;IACzK,MAAM,CAAC,WAAW,IAAI,gBAAgB;IAkCtC,sRAAsR;IACtR,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,gBAAgB,CAAA;KAAE,GAAG,IAAI,CAAC,iBAAiB,GAAG,SAAS;CA2BnF"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { Defaults } from '../../../common/constants/index.js';
|
|
2
|
-
import {
|
|
2
|
+
import { ParseUtility } from '../../../utilities/parse.utility.js';
|
|
3
3
|
import { ModuleUtility } from '../../../utilities/module.utility.js';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import pino from 'pino';
|
|
6
|
-
import { LoggerFormats,
|
|
6
|
+
import { LoggerFormats, LoggerConfigUtility } from '../common/index.js';
|
|
7
7
|
import { PinoFrequencies } from './common/index.js';
|
|
8
8
|
/** Reads `APP_ENV_LOGGER_*` and turns it into a destination. Warning prefixes name the operation, not the class - the tests and the published API still call these `mapFrequency`/`mapMaxFilesToCount`. */
|
|
9
9
|
export class PinoDestination {
|
|
10
10
|
static { this.DEFAULT_FREQUENCY = PinoFrequencies.HOURLY; }
|
|
11
11
|
static { this.DEFAULT_MAX_FILES = '5d'; }
|
|
12
12
|
/** `APP_ENV_LOGGER_FILE_FREQUENCY` -> pino-roll's `frequency`; an unrecognized value warns and falls back rather than throwing, so the app still boots. */
|
|
13
|
-
static mapFrequency(
|
|
13
|
+
static mapFrequency(opts) {
|
|
14
|
+
const { value } = opts;
|
|
14
15
|
const normalized = (value ?? '1h').trim().toLowerCase();
|
|
15
16
|
switch (normalized) {
|
|
16
17
|
case '1h': {
|
|
@@ -59,7 +60,9 @@ export class PinoDestination {
|
|
|
59
60
|
static resolvePlan() {
|
|
60
61
|
const folderPath = process.env.APP_ENV_LOGGER_FOLDER_PATH;
|
|
61
62
|
if (folderPath && folderPath.trim() !== '') {
|
|
62
|
-
const frequency = PinoDestination.mapFrequency(
|
|
63
|
+
const frequency = PinoDestination.mapFrequency({
|
|
64
|
+
value: process.env.APP_ENV_LOGGER_FILE_FREQUENCY,
|
|
65
|
+
});
|
|
63
66
|
const count = PinoDestination.mapMaxFilesToCount({
|
|
64
67
|
value: process.env.APP_ENV_LOGGER_FILE_MAX_FILES,
|
|
65
68
|
frequency,
|
|
@@ -69,7 +72,8 @@ export class PinoDestination {
|
|
|
69
72
|
options: {
|
|
70
73
|
file: path.join(folderPath, Defaults.APPLICATION_NAME),
|
|
71
74
|
frequency,
|
|
72
|
-
size: blankToUndefined(process.env.APP_ENV_LOGGER_FILE_MAX_SIZE) ??
|
|
75
|
+
size: ParseUtility.blankToUndefined({ input: process.env.APP_ENV_LOGGER_FILE_MAX_SIZE }) ??
|
|
76
|
+
'100m',
|
|
73
77
|
limit: { count },
|
|
74
78
|
mkdir: true,
|
|
75
79
|
},
|
|
@@ -82,7 +86,8 @@ export class PinoDestination {
|
|
|
82
86
|
return { kind: 'stdout' };
|
|
83
87
|
}
|
|
84
88
|
/** `pino.transport()` is SYNCHRONOUS - it returns a `ThreadStream` that BUFFERS writes until its worker thread loads, so no async gating is needed; `ModuleUtility.assertInstalled` runs first so a missing optional peer fails loudly here, not as an opaque worker-thread crash. */
|
|
85
|
-
static build(
|
|
89
|
+
static build(opts) {
|
|
90
|
+
const { plan } = opts;
|
|
86
91
|
switch (plan.kind) {
|
|
87
92
|
case 'stdout': {
|
|
88
93
|
return undefined;
|
|
@@ -91,7 +96,7 @@ export class PinoDestination {
|
|
|
91
96
|
ModuleUtility.assertInstalled({ scope: 'PinoLogger', modules: ['pino-pretty'] });
|
|
92
97
|
// Only a decision is forwarded. Left alone, pino-pretty's own `isColorSupported` still
|
|
93
98
|
// suppresses color when stdout is not a terminal - a check winston has no equivalent of.
|
|
94
|
-
const colorize =
|
|
99
|
+
const colorize = LoggerConfigUtility.resolveColorize();
|
|
95
100
|
return pino.transport({
|
|
96
101
|
target: 'pino-pretty',
|
|
97
102
|
...(colorize === undefined ? {} : { options: { colorize } }),
|
|
@@ -107,10 +112,4 @@ export class PinoDestination {
|
|
|
107
112
|
}
|
|
108
113
|
}
|
|
109
114
|
}
|
|
110
|
-
// Published names, kept so `@venizia/ignis-helpers/pino` consumers do not have to move; the class
|
|
111
|
-
// above is the implementation and the entry point for new code.
|
|
112
|
-
export const mapFrequency = (value) => PinoDestination.mapFrequency(value);
|
|
113
|
-
export const mapMaxFilesToCount = (opts) => PinoDestination.mapMaxFilesToCount(opts);
|
|
114
|
-
export const resolveDestinationPlan = () => PinoDestination.resolvePlan();
|
|
115
|
-
export const buildDestination = (plan) => PinoDestination.build(plan);
|
|
116
115
|
//# sourceMappingURL=destination.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"destination.js","sourceRoot":"","sources":["../../../../../src/modules/logger/pino/destination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEjE,OAAO,EAAE,eAAe,EAAmB,MAAM,UAAU,CAAC;AAiB5D,2MAA2M;AAC3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C,CAAC;YACxE,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACR,OAAO,SAAS,CAAC;YACnB,CAAC;QACH,CAAC;IACH,CAAC;;AAGH,kGAAkG;AAClG,gEAAgE;AAChE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAc,EAAc,EAAE,CAAC,eAAe,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;AAEhG,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAA+C,EAAU,EAAE,CAC5F,eAAe,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;AAE3C,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAqB,EAAE,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC;AAE5F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAsB,EAAsC,EAAE,CAC7F,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import { Defaults } from '@/common/constants';\nimport { blankToUndefined } from '@/utilities/parse.utility';\nimport { ModuleUtility } from '@/utilities/module.utility';\nimport path from 'node:path';\nimport pino from 'pino';\nimport { LoggerFormats, resolveLoggerColorize } from '../common';\n\nimport { PinoFrequencies, type TFrequency } from './common';\n\n/** Pure description of where pino should write, derived from env; `PinoDestination.build()` is the impure half that acts on it. */\nexport type TDestinationPlan =\n | { kind: 'stdout' }\n | { kind: 'pretty' }\n | {\n kind: 'roll';\n options: {\n file: string;\n frequency: TFrequency;\n size: string;\n limit: { count: number };\n mkdir: true;\n };\n };\n\n/** Reads `APP_ENV_LOGGER_*` and turns it into a destination. Warning prefixes name the operation, not the class - the tests and the published API still call these `mapFrequency`/`mapMaxFilesToCount`. */\nexport class PinoDestination {\n private static readonly DEFAULT_FREQUENCY: TFrequency = PinoFrequencies.HOURLY;\n private static readonly DEFAULT_MAX_FILES = '5d';\n\n /** `APP_ENV_LOGGER_FILE_FREQUENCY` -> pino-roll's `frequency`; an unrecognized value warns and falls back rather than throwing, so the app still boots. */\n static mapFrequency(value?: string): TFrequency {\n const normalized = (value ?? '1h').trim().toLowerCase();\n\n switch (normalized) {\n case '1h': {\n return PinoFrequencies.HOURLY;\n }\n case '1d':\n case '24h': {\n return PinoFrequencies.DAILY;\n }\n default: {\n console.warn(\n '[mapFrequency] Invalid logger file frequency | value: %s | fallback: %s',\n value,\n PinoDestination.DEFAULT_FREQUENCY,\n );\n return PinoDestination.DEFAULT_FREQUENCY;\n }\n }\n }\n\n /** `null` means \"not a recognized shape\" - the caller decides what default to fall back to. */\n private static parseMaxFilesValue(value: string, frequency: TFrequency): number | null {\n const dayMatch = /^(\\d+)d$/i.exec(value);\n if (dayMatch) {\n const days = Number.parseInt(dayMatch[1], 10);\n return frequency === 'hourly' ? days * 24 : days;\n }\n\n const bareMatch = /^\\d+$/.exec(value);\n if (bareMatch) {\n return Number.parseInt(value, 10);\n }\n\n return null;\n }\n\n /** `APP_ENV_LOGGER_FILE_MAX_FILES` -> pino-roll's `limit.count`: `'<n>d'` scales by frequency (hourly: days*24), a bare integer is a literal count, unrecognized falls back to `'5d'`. */\n static mapMaxFilesToCount(opts: { value?: string; frequency: TFrequency }): number {\n const { value, frequency } = opts;\n const normalized = value?.trim();\n\n if (normalized) {\n const parsed = PinoDestination.parseMaxFilesValue(normalized, frequency);\n if (parsed !== null) {\n return parsed;\n }\n }\n\n // Unset is a normal configuration (mirror the sibling defaults) - only a PROVIDED value that failed to parse deserves a warning.\n if (normalized && normalized !== PinoDestination.DEFAULT_MAX_FILES) {\n console.warn(\n '[mapMaxFilesToCount] Invalid logger file max files value | value: %s | fallback: %s',\n value,\n PinoDestination.DEFAULT_MAX_FILES,\n );\n }\n\n return PinoDestination.parseMaxFilesValue(\n PinoDestination.DEFAULT_MAX_FILES,\n frequency,\n ) as number;\n }\n\n /** Pure: which destination pino should write to, derived from `APP_ENV_LOGGER_*` at CALL time. `DATE_PATTERN` is deliberately not read - pino-roll has no equivalent. */\n static resolvePlan(): TDestinationPlan {\n const folderPath = process.env.APP_ENV_LOGGER_FOLDER_PATH;\n\n if (folderPath && folderPath.trim() !== '') {\n const frequency = PinoDestination.mapFrequency(process.env.APP_ENV_LOGGER_FILE_FREQUENCY);\n const count = PinoDestination.mapMaxFilesToCount({\n value: process.env.APP_ENV_LOGGER_FILE_MAX_FILES,\n frequency,\n });\n\n return {\n kind: 'roll',\n options: {\n file: path.join(folderPath, Defaults.APPLICATION_NAME),\n frequency,\n size: blankToUndefined(process.env.APP_ENV_LOGGER_FILE_MAX_SIZE) ?? '100m',\n limit: { count },\n mkdir: true,\n },\n };\n }\n\n // UNSET means NDJSON to stdout, the locked default for this provider; only an EXPLICIT `text` opts into pino-pretty, and falling back to TEXT here (winston's default) would make the documented minimal install (pino only, no pino-pretty) crash on its first log line.\n if (process.env.APP_ENV_LOGGER_FORMAT === LoggerFormats.TEXT) {\n return { kind: 'pretty' };\n }\n\n return { kind: 'stdout' };\n }\n\n /** `pino.transport()` is SYNCHRONOUS - it returns a `ThreadStream` that BUFFERS writes until its worker thread loads, so no async gating is needed; `ModuleUtility.assertInstalled` runs first so a missing optional peer fails loudly here, not as an opaque worker-thread crash. */\n static build(plan: TDestinationPlan): pino.DestinationStream | undefined {\n switch (plan.kind) {\n case 'stdout': {\n return undefined;\n }\n case 'pretty': {\n ModuleUtility.assertInstalled({ scope: 'PinoLogger', modules: ['pino-pretty'] });\n\n // Only a decision is forwarded. Left alone, pino-pretty's own `isColorSupported` still\n // suppresses color when stdout is not a terminal - a check winston has no equivalent of.\n const colorize = resolveLoggerColorize();\n return pino.transport({\n target: 'pino-pretty',\n ...(colorize === undefined ? {} : { options: { colorize } }),\n });\n }\n case 'roll': {\n ModuleUtility.assertInstalled({ scope: 'PinoLogger', modules: ['pino-roll'] });\n return pino.transport({ target: 'pino-roll', options: plan.options });\n }\n default: {\n return undefined;\n }\n }\n }\n}\n\n// Published names, kept so `@venizia/ignis-helpers/pino` consumers do not have to move; the class\n// above is the implementation and the entry point for new code.\nexport const mapFrequency = (value?: string): TFrequency => PinoDestination.mapFrequency(value);\n\nexport const mapMaxFilesToCount = (opts: { value?: string; frequency: TFrequency }): number =>\n PinoDestination.mapMaxFilesToCount(opts);\n\nexport const resolveDestinationPlan = (): TDestinationPlan => PinoDestination.resolvePlan();\n\nexport const buildDestination = (plan: TDestinationPlan): pino.DestinationStream | undefined =>\n PinoDestination.build(plan);\n"]}
|
|
1
|
+
{"version":3,"file":"destination.js","sourceRoot":"","sources":["../../../../../src/modules/logger/pino/destination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAmB,MAAM,UAAU,CAAC;AAiB5D,2MAA2M;AAC3M,MAAM,OAAO,eAAe;aACF,sBAAiB,GAAe,eAAe,CAAC,MAAM,CAAC;aACvD,sBAAiB,GAAG,IAAI,CAAC;IAEjD,2JAA2J;IAC3J,MAAM,CAAC,YAAY,CAAC,IAAwB;QAC1C,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;QACvB,MAAM,UAAU,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAExD,QAAQ,UAAU,EAAE,CAAC;YACnB,KAAK,IAAI,CAAC,CAAC,CAAC;gBACV,OAAO,eAAe,CAAC,MAAM,CAAC;YAChC,CAAC;YACD,KAAK,IAAI,CAAC;YACV,KAAK,KAAK,CAAC,CAAC,CAAC;gBACX,OAAO,eAAe,CAAC,KAAK,CAAC;YAC/B,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACR,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,GAAG,IAAI,CAAC;QAEtB,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;YAClB,KAAK,QAAQ,CAAC,CAAC,CAAC;gBACd,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,KAAK,QAAQ,CAAC,CAAC,CAAC;gBACd,aAAa,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;gBAEjF,uFAAuF;gBACvF,yFAAyF;gBACzF,MAAM,QAAQ,GAAG,mBAAmB,CAAC,eAAe,EAAE,CAAC;gBACvD,OAAO,IAAI,CAAC,SAAS,CAAC;oBACpB,MAAM,EAAE,aAAa;oBACrB,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,CAAC;iBAC7D,CAAC,CAAC;YACL,CAAC;YACD,KAAK,MAAM,CAAC,CAAC,CAAC;gBACZ,aAAa,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;gBAC/E,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;YACxE,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACR,OAAO,SAAS,CAAC;YACnB,CAAC;QACH,CAAC;IACH,CAAC","sourcesContent":["import { Defaults } from '@/common/constants';\nimport { ParseUtility } from '@/utilities/parse.utility';\nimport { ModuleUtility } from '@/utilities/module.utility';\nimport path from 'node:path';\nimport pino from 'pino';\nimport { LoggerFormats, LoggerConfigUtility } from '../common';\n\nimport { PinoFrequencies, type TFrequency } from './common';\n\n/** Pure description of where pino should write, derived from env; `PinoDestination.build()` is the impure half that acts on it. */\nexport type TDestinationPlan =\n | { kind: 'stdout' }\n | { kind: 'pretty' }\n | {\n kind: 'roll';\n options: {\n file: string;\n frequency: TFrequency;\n size: string;\n limit: { count: number };\n mkdir: true;\n };\n };\n\n/** Reads `APP_ENV_LOGGER_*` and turns it into a destination. Warning prefixes name the operation, not the class - the tests and the published API still call these `mapFrequency`/`mapMaxFilesToCount`. */\nexport class PinoDestination {\n private static readonly DEFAULT_FREQUENCY: TFrequency = PinoFrequencies.HOURLY;\n private static readonly DEFAULT_MAX_FILES = '5d';\n\n /** `APP_ENV_LOGGER_FILE_FREQUENCY` -> pino-roll's `frequency`; an unrecognized value warns and falls back rather than throwing, so the app still boots. */\n static mapFrequency(opts: { value?: string }): TFrequency {\n const { value } = opts;\n const normalized = (value ?? '1h').trim().toLowerCase();\n\n switch (normalized) {\n case '1h': {\n return PinoFrequencies.HOURLY;\n }\n case '1d':\n case '24h': {\n return PinoFrequencies.DAILY;\n }\n default: {\n console.warn(\n '[mapFrequency] Invalid logger file frequency | value: %s | fallback: %s',\n value,\n PinoDestination.DEFAULT_FREQUENCY,\n );\n return PinoDestination.DEFAULT_FREQUENCY;\n }\n }\n }\n\n /** `null` means \"not a recognized shape\" - the caller decides what default to fall back to. */\n private static parseMaxFilesValue(value: string, frequency: TFrequency): number | null {\n const dayMatch = /^(\\d+)d$/i.exec(value);\n if (dayMatch) {\n const days = Number.parseInt(dayMatch[1], 10);\n return frequency === 'hourly' ? days * 24 : days;\n }\n\n const bareMatch = /^\\d+$/.exec(value);\n if (bareMatch) {\n return Number.parseInt(value, 10);\n }\n\n return null;\n }\n\n /** `APP_ENV_LOGGER_FILE_MAX_FILES` -> pino-roll's `limit.count`: `'<n>d'` scales by frequency (hourly: days*24), a bare integer is a literal count, unrecognized falls back to `'5d'`. */\n static mapMaxFilesToCount(opts: { value?: string; frequency: TFrequency }): number {\n const { value, frequency } = opts;\n const normalized = value?.trim();\n\n if (normalized) {\n const parsed = PinoDestination.parseMaxFilesValue(normalized, frequency);\n if (parsed !== null) {\n return parsed;\n }\n }\n\n // Unset is a normal configuration (mirror the sibling defaults) - only a PROVIDED value that failed to parse deserves a warning.\n if (normalized && normalized !== PinoDestination.DEFAULT_MAX_FILES) {\n console.warn(\n '[mapMaxFilesToCount] Invalid logger file max files value | value: %s | fallback: %s',\n value,\n PinoDestination.DEFAULT_MAX_FILES,\n );\n }\n\n return PinoDestination.parseMaxFilesValue(\n PinoDestination.DEFAULT_MAX_FILES,\n frequency,\n ) as number;\n }\n\n /** Pure: which destination pino should write to, derived from `APP_ENV_LOGGER_*` at CALL time. `DATE_PATTERN` is deliberately not read - pino-roll has no equivalent. */\n static resolvePlan(): TDestinationPlan {\n const folderPath = process.env.APP_ENV_LOGGER_FOLDER_PATH;\n\n if (folderPath && folderPath.trim() !== '') {\n const frequency = PinoDestination.mapFrequency({\n value: process.env.APP_ENV_LOGGER_FILE_FREQUENCY,\n });\n const count = PinoDestination.mapMaxFilesToCount({\n value: process.env.APP_ENV_LOGGER_FILE_MAX_FILES,\n frequency,\n });\n\n return {\n kind: 'roll',\n options: {\n file: path.join(folderPath, Defaults.APPLICATION_NAME),\n frequency,\n size:\n ParseUtility.blankToUndefined({ input: process.env.APP_ENV_LOGGER_FILE_MAX_SIZE }) ??\n '100m',\n limit: { count },\n mkdir: true,\n },\n };\n }\n\n // UNSET means NDJSON to stdout, the locked default for this provider; only an EXPLICIT `text` opts into pino-pretty, and falling back to TEXT here (winston's default) would make the documented minimal install (pino only, no pino-pretty) crash on its first log line.\n if (process.env.APP_ENV_LOGGER_FORMAT === LoggerFormats.TEXT) {\n return { kind: 'pretty' };\n }\n\n return { kind: 'stdout' };\n }\n\n /** `pino.transport()` is SYNCHRONOUS - it returns a `ThreadStream` that BUFFERS writes until its worker thread loads, so no async gating is needed; `ModuleUtility.assertInstalled` runs first so a missing optional peer fails loudly here, not as an opaque worker-thread crash. */\n static build(opts: { plan: TDestinationPlan }): pino.DestinationStream | undefined {\n const { plan } = opts;\n\n switch (plan.kind) {\n case 'stdout': {\n return undefined;\n }\n case 'pretty': {\n ModuleUtility.assertInstalled({ scope: 'PinoLogger', modules: ['pino-pretty'] });\n\n // Only a decision is forwarded. Left alone, pino-pretty's own `isColorSupported` still\n // suppresses color when stdout is not a terminal - a check winston has no equivalent of.\n const colorize = LoggerConfigUtility.resolveColorize();\n return pino.transport({\n target: 'pino-pretty',\n ...(colorize === undefined ? {} : { options: { colorize } }),\n });\n }\n case 'roll': {\n ModuleUtility.assertInstalled({ scope: 'PinoLogger', modules: ['pino-roll'] });\n return pino.transport({ target: 'pino-roll', options: plan.options });\n }\n default: {\n return undefined;\n }\n }\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseLogger } from '../base/index.js';
|
|
2
|
-
import {
|
|
2
|
+
import { LogFormatUtility } from '../formatting/index.js';
|
|
3
3
|
import { PinoBackingLogger } from './backing.js';
|
|
4
4
|
/** pino provider satisfying `ILoggerProvider`, staying pino-native: numeric levels, `msg`, epoch `time`, pid/hostname pass through unchanged. No custom-instance param on `get()` unlike `WinstonLogger.get` - advanced/test injection goes through `PinoBackingLogger.set()`. */
|
|
5
5
|
export class PinoLogger extends BaseLogger {
|
|
@@ -18,7 +18,7 @@ export class PinoLogger extends BaseLogger {
|
|
|
18
18
|
/** Resolves the backing instance at WRITE time and never caches it, so `PinoBackingLogger.set()` takes effect for every already-issued scope immediately. */
|
|
19
19
|
write(opts) {
|
|
20
20
|
const line = opts.args.length > 0
|
|
21
|
-
?
|
|
21
|
+
? LogFormatUtility.formatMessage({ message: opts.message, args: opts.args })
|
|
22
22
|
: opts.message;
|
|
23
23
|
const backing = PinoBackingLogger.get();
|
|
24
24
|
backing[opts.level](this._formattedPrefix + line);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../../../src/modules/logger/pino/logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,gBAAgB,EAAE,MAA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Aa;QACtB,IAAI,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;YAC/B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAChC,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,6JAA6J;IACnJ,KAAK,CAAC,IAAiE;QAC/E,MAAM,IAAI,GACR,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC;YAClB,CAAC,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;YAC5E,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;QAEnB,MAAM,OAAO,GAAG,iBAAiB,CAAC,GAAG,EAAa,CAAC;QACnD,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IACpD,CAAC;IAES,KAAK,CAAC,IAAuB;QACrC,OAAO,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC","sourcesContent":["import { type AnyType } from '@/common/types';\nimport { BaseLogger } from '../base';\nimport { type ILogger, type TLogLevel } from '../common';\nimport { LogFormatUtility } from '../formatting';\nimport { PinoBackingLogger } from './backing';\n\n/** pino provider satisfying `ILoggerProvider`, staying pino-native: numeric levels, `msg`, epoch `time`, pid/hostname pass through unchanged. No custom-instance param on `get()` unlike `WinstonLogger.get` - advanced/test injection goes through `PinoBackingLogger.set()`. */\nexport class PinoLogger extends BaseLogger {\n private static cache = new Map<string, PinoLogger>();\n\n private constructor(scope: string) {\n super({ scope });\n }\n\n static get(scope: string): PinoLogger {\n let cached = this.cache.get(scope);\n if (!cached) {\n cached = new PinoLogger(scope);\n this.cache.set(scope, cached);\n }\n\n return cached;\n }\n\n /** Resolves the backing instance at WRITE time and never caches it, so `PinoBackingLogger.set()` takes effect for every already-issued scope immediately. */\n protected write(opts: { level: TLogLevel; message: string; args: Array<AnyType> }) {\n const line =\n opts.args.length > 0\n ? LogFormatUtility.formatMessage({ message: opts.message, args: opts.args })\n : opts.message;\n\n const backing = PinoBackingLogger.get() as AnyType;\n backing[opts.level](this._formattedPrefix + line);\n }\n\n protected child(opts: { scope: string }): ILogger {\n return PinoLogger.get(opts.scope);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/logger/winston/common/constants.ts"],"names":[],"mappings":"AAGA,gGAAgG;AAChG,eAAO,MAAM,aAAa,QAA4B,CAAC;AACvD,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/logger/winston/common/constants.ts"],"names":[],"mappings":"AAGA,gGAAgG;AAChG,eAAO,MAAM,aAAa,QAA4B,CAAC;AACvD,eAAO,MAAM,aAAa,QAC6D,CAAC;AAExF,eAAO,MAAM,qBAAqB,QAC2D,CAAC;AAC9F,eAAO,MAAM,oBAAoB,QAC6D,CAAC;AAC/F,eAAO,MAAM,qBAAqB,QAC2D,CAAC;AAC9F,eAAO,MAAM,wBAAwB,QAEtB,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ParseUtility } from '../../../../utilities/parse.utility.js';
|
|
2
2
|
import { Defaults } from '../../../../common/constants/index.js';
|
|
3
3
|
/** Not re-exported from `common/index.ts` - keeps these off the `/winston` sub-path surface. */
|
|
4
4
|
export const LOGGER_PREFIX = Defaults.APPLICATION_NAME;
|
|
5
|
-
export const LOGGER_FORMAT = blankToUndefined(process.env.APP_ENV_LOGGER_FORMAT) ?? 'text';
|
|
6
|
-
export const LOGGER_FILE_FREQUENCY = blankToUndefined(process.env.APP_ENV_LOGGER_FILE_FREQUENCY) ?? '1h';
|
|
7
|
-
export const LOGGER_FILE_MAX_SIZE = blankToUndefined(process.env.APP_ENV_LOGGER_FILE_MAX_SIZE) ?? '100m';
|
|
8
|
-
export const LOGGER_FILE_MAX_FILES = blankToUndefined(process.env.APP_ENV_LOGGER_FILE_MAX_FILES) ?? '5d';
|
|
9
|
-
export const LOGGER_FILE_DATE_PATTERN = blankToUndefined(process.env.APP_ENV_LOGGER_FILE_DATE_PATTERN) ??
|
|
5
|
+
export const LOGGER_FORMAT = ParseUtility.blankToUndefined({ input: process.env.APP_ENV_LOGGER_FORMAT }) ?? 'text';
|
|
6
|
+
export const LOGGER_FILE_FREQUENCY = ParseUtility.blankToUndefined({ input: process.env.APP_ENV_LOGGER_FILE_FREQUENCY }) ?? '1h';
|
|
7
|
+
export const LOGGER_FILE_MAX_SIZE = ParseUtility.blankToUndefined({ input: process.env.APP_ENV_LOGGER_FILE_MAX_SIZE }) ?? '100m';
|
|
8
|
+
export const LOGGER_FILE_MAX_FILES = ParseUtility.blankToUndefined({ input: process.env.APP_ENV_LOGGER_FILE_MAX_FILES }) ?? '5d';
|
|
9
|
+
export const LOGGER_FILE_DATE_PATTERN = ParseUtility.blankToUndefined({ input: process.env.APP_ENV_LOGGER_FILE_DATE_PATTERN }) ??
|
|
10
|
+
'YYYYMMDD_HH';
|
|
10
11
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../src/modules/logger/winston/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../src/modules/logger/winston/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,gGAAgG;AAChG,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC,gBAAgB,CAAC;AACvD,MAAM,CAAC,MAAM,aAAa,GACxB,YAAY,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC,IAAI,MAAM,CAAC;AAExF,MAAM,CAAC,MAAM,qBAAqB,GAChC,YAAY,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,CAAC,IAAI,IAAI,CAAC;AAC9F,MAAM,CAAC,MAAM,oBAAoB,GAC/B,YAAY,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAE,CAAC,IAAI,MAAM,CAAC;AAC/F,MAAM,CAAC,MAAM,qBAAqB,GAChC,YAAY,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,CAAC,IAAI,IAAI,CAAC;AAC9F,MAAM,CAAC,MAAM,wBAAwB,GACnC,YAAY,CAAC,gBAAgB,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAE,CAAC;IACtF,aAAa,CAAC","sourcesContent":["import { ParseUtility } from '@/utilities/parse.utility';\nimport { Defaults } from '@/common/constants';\n\n/** Not re-exported from `common/index.ts` - keeps these off the `/winston` sub-path surface. */\nexport const LOGGER_PREFIX = Defaults.APPLICATION_NAME;\nexport const LOGGER_FORMAT =\n ParseUtility.blankToUndefined({ input: process.env.APP_ENV_LOGGER_FORMAT }) ?? 'text';\n\nexport const LOGGER_FILE_FREQUENCY =\n ParseUtility.blankToUndefined({ input: process.env.APP_ENV_LOGGER_FILE_FREQUENCY }) ?? '1h';\nexport const LOGGER_FILE_MAX_SIZE =\n ParseUtility.blankToUndefined({ input: process.env.APP_ENV_LOGGER_FILE_MAX_SIZE }) ?? '100m';\nexport const LOGGER_FILE_MAX_FILES =\n ParseUtility.blankToUndefined({ input: process.env.APP_ENV_LOGGER_FILE_MAX_FILES }) ?? '5d';\nexport const LOGGER_FILE_DATE_PATTERN =\n ParseUtility.blankToUndefined({ input: process.env.APP_ENV_LOGGER_FILE_DATE_PATTERN }) ??\n 'YYYYMMDD_HH';\n"]}
|