diff --git a/package-lock.json b/package-lock.json index 11d1f0b..a12088e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -831,7 +831,8 @@ "version": "0.4.0", "resolved": "https://registry.npmjs.org/@pinojs/redact/-/redact-0.4.0.tgz", "integrity": "sha512-k2ENnmBugE/rzQfEcdWHcCY+/FM3VLzH9cYEsbdsoqrvzAKRhUZeRNhAZvB8OitQJ1TBed3yqWtdjzS6wJKBwg==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/@rollup/plugin-json": { "version": "6.1.0", @@ -1359,7 +1360,6 @@ "integrity": "sha512-1N9SBnWYOJTrNZCdh/yJE+t910Y128BoyY+zBLWhL3r0TYzlTmFdXrPwHL9DyFZmlEXNQQolTZh3KHV31QDhyA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "undici-types": "~6.21.0" } @@ -1406,7 +1406,6 @@ "integrity": "sha512-iIACsx8pxRnguSYhHiMn2PvhvfpopO9FXHyn1mG5txZIsAaB6F0KwbFnUQN3KCiG3Jcuad/Cao2FAs1Wp7vAyg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.52.0", "@typescript-eslint/types": "8.52.0", @@ -1736,7 +1735,6 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", - "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -1866,6 +1864,7 @@ "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==", "license": "MIT", + "peer": true, "engines": { "node": ">=8.0.0" } @@ -2210,7 +2209,6 @@ "integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -3196,6 +3194,7 @@ "resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz", "integrity": "sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==", "license": "MIT", + "peer": true, "engines": { "node": ">=14.0.0" } @@ -3365,6 +3364,7 @@ "resolved": "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-2.0.0.tgz", "integrity": "sha512-F63x5tizV6WCh4R6RHyi2Ml+M70DNRXt/+HANowMflpgGFMAym/VKm6G7ZOQRjqN7XbGxK1Lg9t6ZrtzOaivMw==", "license": "MIT", + "peer": true, "dependencies": { "split2": "^4.0.0" } @@ -3373,7 +3373,8 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-7.0.0.tgz", "integrity": "sha512-e906FRY0+tV27iq4juKzSYPbUj2do2X2JX4EzSca1631EB2QJQUqGbDuERal7LCtOpxl6x3+nvo9NPZcmjkiFA==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/plimit-lit": { "version": "1.6.1", @@ -3441,7 +3442,8 @@ "url": "https://opencollective.com/fastify" } ], - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/punycode": { "version": "2.3.1", @@ -3488,7 +3490,8 @@ "version": "4.0.4", "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz", "integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/readdirp": { "version": "3.6.0", @@ -3521,6 +3524,7 @@ "resolved": "https://registry.npmjs.org/real-require/-/real-require-0.2.0.tgz", "integrity": "sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==", "license": "MIT", + "peer": true, "engines": { "node": ">= 12.13.0" } @@ -3596,7 +3600,6 @@ "integrity": "sha512-wDv/Ht1BNHB4upNbK74s9usvl7hObDnvVzknxqY/E/O3X6rW1U1rV1aENEfJ54eFZDTNo7zv1f5N4edCluH7+A==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/estree": "1.0.8" }, @@ -3688,6 +3691,7 @@ "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz", "integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==", "license": "MIT", + "peer": true, "engines": { "node": ">=10" } @@ -3750,6 +3754,7 @@ "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-4.2.0.tgz", "integrity": "sha512-INb7TM37/mAcsGmc9hyyI6+QR3rR1zVRu36B0NeGXKnOOLiZOfER5SA+N7X7k3yUYRzLWafduTDvJAfDswwEww==", "license": "MIT", + "peer": true, "dependencies": { "atomic-sleep": "^1.0.0" } @@ -3769,6 +3774,7 @@ "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", "license": "ISC", + "peer": true, "engines": { "node": ">= 10.x" } @@ -3861,6 +3867,7 @@ "resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-3.1.0.tgz", "integrity": "sha512-OqyPZ9u96VohAyMfJykzmivOrY2wfMSf3C5TtFJVgN+Hm6aj+voFhlK+kZEIv2FBh1X6Xp3DlnCOfEQ3B2J86A==", "license": "MIT", + "peer": true, "dependencies": { "real-require": "^0.2.0" } @@ -4059,8 +4066,7 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "dev": true, - "license": "0BSD", - "peer": true + "license": "0BSD" }, "node_modules/tsx": { "version": "4.21.0", @@ -4068,7 +4074,6 @@ "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "esbuild": "~0.27.0", "get-tsconfig": "^4.7.5" @@ -4102,7 +4107,6 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -4165,7 +4169,6 @@ "integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", diff --git a/src/node/logging/logger.ts b/src/node/logging/logger.ts index cb4c398..e6b07a8 100644 --- a/src/node/logging/logger.ts +++ b/src/node/logging/logger.ts @@ -3,23 +3,19 @@ import pino from 'pino' /** - * Build and configure a base `pino` logger instance used by the helpers. + * Shared pino logger instance used by all logging functions. * * The logger uses ISO timestamps and a simple level formatter that exposes * the textual level as the `level` property on emitted objects. - * - * @returns {import('pino').Logger} A configured pino logger instance. */ -const buildBaseLogger = () => { - return pino({ - timestamp: pino.stdTimeFunctions.isoTime, - formatters: { - level(label, number) { - return { level: label } - } +const logger = pino({ + timestamp: pino.stdTimeFunctions.isoTime, + formatters: { + level(label, number) { + return { level: label } } - }) -} + } +}) /** @@ -30,7 +26,7 @@ const buildBaseLogger = () => { * @param {Record} [options={}] - Additional metadata to include. */ export const loggyInfo = (label: string, message: string, options: Record = {}): void => { - buildBaseLogger().info({ ...options, label, message }) + logger.info({ ...options, label, message }) } @@ -42,7 +38,7 @@ export const loggyInfo = (label: string, message: string, options: Record} [options={}] - Additional metadata to include. */ export const loggyDebug = (label: string, message: string, options: Record = {}): void => { - buildBaseLogger().debug({ ...options, label, message }) + logger.debug({ ...options, label, message }) } @@ -54,7 +50,7 @@ export const loggyDebug = (label: string, message: string, options: Record} [options={}] - Additional metadata to include. */ export const loggyWarn = (label: string, message: string, options: Record = {}): void => { - buildBaseLogger().warn({ ...options, label, message }) + logger.warn({ ...options, label, message }) } @@ -66,7 +62,7 @@ export const loggyWarn = (label: string, message: string, options: Record} [options={}] - Additional metadata to include. */ export const loggyTrace = (label: string, message: string, options: Record = {}): void => { - buildBaseLogger().trace({ ...options, label, message }) + logger.trace({ ...options, label, message }) } @@ -80,7 +76,7 @@ export const loggyTrace = (label: string, message: string, options: Record} [options={}] - Additional metadata to include. */ export const loggyFatal = (label: string, message: string, options: Record = {}): void => { - buildBaseLogger().fatal({ ...options, label, message }) + logger.fatal({ ...options, label, message }) } @@ -95,7 +91,7 @@ export const loggyFatal = (label: string, message: string, options: Record = {}): void => { const message = typeof err === 'string' ? err : err.message const extra = typeof err === 'string' ? options : { ...options, stack: err.stack } - buildBaseLogger().error({ ...extra, label, message }) + logger.error({ ...extra, label, message }) } @@ -125,7 +121,7 @@ export const loggyRequestReceived = ( route: string, method: string, options: Record = {}) => { - loggyInfo("Request Recieved", `${method}: ${route}`, options) + loggyInfo("Request Received", `${method}: ${route}`, options) }