diff --git a/package-lock.json b/package-lock.json index a38205c..5116b71 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,8 +14,7 @@ "pino": "^8.19.0", "pino-pretty": "^10.3.1", "pino-roll": "^1.0.0-rc.1", - "pony-cause": "^2.1.10", - "tsx": "^4.7.0" + "pony-cause": "^2.1.10" }, "devDependencies": { "@types/chai": "^4.3.0", @@ -33,7 +32,9 @@ "ts-node": "^10.9.1", "tsconfig-paths": "^4.2.0", "tshy": "^1.7.0", + "tsx": "^4.7.1", "typedoc": "^0.25.11", + "typedoc-plugin-inline-sources": "^1.0.2", "typedoc-plugin-missing-exports": "^2.2.0", "typedoc-plugin-replace-text": "^3.3.0", "typescript": "^5.3.3", @@ -76,6 +77,7 @@ "cpu": [ "ppc64" ], + "dev": true, "optional": true, "os": [ "aix" @@ -91,6 +93,7 @@ "cpu": [ "arm" ], + "dev": true, "optional": true, "os": [ "android" @@ -106,6 +109,7 @@ "cpu": [ "arm64" ], + "dev": true, "optional": true, "os": [ "android" @@ -121,6 +125,7 @@ "cpu": [ "x64" ], + "dev": true, "optional": true, "os": [ "android" @@ -136,6 +141,7 @@ "cpu": [ "arm64" ], + "dev": true, "optional": true, "os": [ "darwin" @@ -151,6 +157,7 @@ "cpu": [ "x64" ], + "dev": true, "optional": true, "os": [ "darwin" @@ -166,6 +173,7 @@ "cpu": [ "arm64" ], + "dev": true, "optional": true, "os": [ "freebsd" @@ -181,6 +189,7 @@ "cpu": [ "x64" ], + "dev": true, "optional": true, "os": [ "freebsd" @@ -196,6 +205,7 @@ "cpu": [ "arm" ], + "dev": true, "optional": true, "os": [ "linux" @@ -211,6 +221,7 @@ "cpu": [ "arm64" ], + "dev": true, "optional": true, "os": [ "linux" @@ -226,6 +237,7 @@ "cpu": [ "ia32" ], + "dev": true, "optional": true, "os": [ "linux" @@ -241,6 +253,7 @@ "cpu": [ "loong64" ], + "dev": true, "optional": true, "os": [ "linux" @@ -256,6 +269,7 @@ "cpu": [ "mips64el" ], + "dev": true, "optional": true, "os": [ "linux" @@ -271,6 +285,7 @@ "cpu": [ "ppc64" ], + "dev": true, "optional": true, "os": [ "linux" @@ -286,6 +301,7 @@ "cpu": [ "riscv64" ], + "dev": true, "optional": true, "os": [ "linux" @@ -301,6 +317,7 @@ "cpu": [ "s390x" ], + "dev": true, "optional": true, "os": [ "linux" @@ -316,6 +333,7 @@ "cpu": [ "x64" ], + "dev": true, "optional": true, "os": [ "linux" @@ -331,6 +349,7 @@ "cpu": [ "x64" ], + "dev": true, "optional": true, "os": [ "netbsd" @@ -346,6 +365,7 @@ "cpu": [ "x64" ], + "dev": true, "optional": true, "os": [ "openbsd" @@ -361,6 +381,7 @@ "cpu": [ "x64" ], + "dev": true, "optional": true, "os": [ "sunos" @@ -376,6 +397,7 @@ "cpu": [ "arm64" ], + "dev": true, "optional": true, "os": [ "win32" @@ -391,6 +413,7 @@ "cpu": [ "ia32" ], + "dev": true, "optional": true, "os": [ "win32" @@ -406,6 +429,7 @@ "cpu": [ "x64" ], + "dev": true, "optional": true, "os": [ "win32" @@ -1174,6 +1198,7 @@ "version": "0.19.12", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.12.tgz", "integrity": "sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg==", + "dev": true, "hasInstallScript": true, "bin": { "esbuild": "bin/esbuild" @@ -1345,6 +1370,7 @@ "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, "hasInstallScript": true, "optional": true, "os": [ @@ -1399,9 +1425,10 @@ } }, "node_modules/get-tsconfig": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.2.tgz", - "integrity": "sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==", + "version": "4.7.3", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.3.tgz", + "integrity": "sha512-ZvkrzoUA0PQZM6fy6+/Hce561s+faD1rsNwhnO5FelNjyy7EMGJ3Rz1AQ8GYDWjhRs/7dBLOEJvhK8MiEJOAFg==", + "dev": true, "dependencies": { "resolve-pkg-maps": "^1.0.0" }, @@ -2408,6 +2435,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, "funding": { "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" } @@ -3105,6 +3133,7 @@ "version": "4.7.1", "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.7.1.tgz", "integrity": "sha512-8d6VuibXHtlN5E3zFkgY8u4DX7Y3Z27zvvPKVmLon/D4AjuKzarkUBTLDBgj9iTQ0hg5xM7c/mYiRVM+HETf0g==", + "dev": true, "dependencies": { "esbuild": "~0.19.10", "get-tsconfig": "^4.7.2" @@ -3149,6 +3178,18 @@ "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x" } }, + "node_modules/typedoc-plugin-inline-sources": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/typedoc-plugin-inline-sources/-/typedoc-plugin-inline-sources-1.0.2.tgz", + "integrity": "sha512-J1L2Ky6t5EeAI2fTqhcRii/ntxYN6lSPyKiaTKc/MIHgMTDh81elRvXPZFmvy+xMY9EEE9nlkUujfLGNo5c5Tw==", + "dev": true, + "engines": { + "node": ">= 10.8.0" + }, + "peerDependencies": { + "typedoc": "^0.25.7" + } + }, "node_modules/typedoc-plugin-missing-exports": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/typedoc-plugin-missing-exports/-/typedoc-plugin-missing-exports-2.2.0.tgz", diff --git a/package.json b/package.json index 643571f..a9a89b1 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "repository": "https://github.com/foxxmd/logging", "description": "", "scripts": { - "typedoc": "typedoc --plugin typedoc-plugin-missing-exports --plugin typedoc-plugin-replace-text --media ./assets", + "typedoc": "typedoc --plugin typedoc-plugin-missing-exports --plugin typedoc-plugin-replace-text --plugin typedoc-plugin-inline-sources --media ./assets", "build": "tsc", "prepare": "tshy", "test": "mocha --reporter spec --recursive ./tests/*.test.ts", @@ -50,7 +50,9 @@ "ts-node": "^10.9.1", "tsconfig-paths": "^4.2.0", "tshy": "^1.7.0", + "tsx": "^4.7.1", "typedoc": "^0.25.11", + "typedoc-plugin-inline-sources": "^1.0.2", "typedoc-plugin-missing-exports": "^2.2.0", "typedoc-plugin-replace-text": "^3.3.0", "typescript": "^5.3.3", @@ -62,8 +64,7 @@ "pino": "^8.19.0", "pino-pretty": "^10.3.1", "pino-roll": "^1.0.0-rc.1", - "pony-cause": "^2.1.10", - "tsx": "^4.7.0" + "pony-cause": "^2.1.10" }, "overrides": { "with-local-tmp-dir": { diff --git a/src/loggers.ts b/src/loggers.ts index a9cede0..936f055 100644 --- a/src/loggers.ts +++ b/src/loggers.ts @@ -42,8 +42,19 @@ export const childLogger = (parent: Logger, labelsVal: any | any[] = [], context } return newChild } +/** + * A noop (no output) logger for use when testing a component that requires a Logger + * + * @source + * */ export const loggerTest = buildLogger('silent', [buildDestinationStdout('debug')]); + +/** + * A logger that ONLY logs to console at minimum 'debug' level. Useful for logging during startup before a loggerApp has been initialized + * + * @source + * */ export const loggerDebug = buildLogger('debug', [buildDestinationStdout('debug')]); export const loggerApp = (config: LogOptions | object = {}) => { diff --git a/src/pretty.ts b/src/pretty.ts index 69467fd..3962ce2 100644 --- a/src/pretty.ts +++ b/src/pretty.ts @@ -29,7 +29,17 @@ export const prettyOptsFactory = (opts: PrettyOptions = {}): PrettyOptions => { ...opts } } +/** + * Pre-defined pretty options for use with console/stream output + * + * @source + * */ export const prettyConsole: PrettyOptions = prettyOptsFactory({sync: true}) +/** + * Pre-defined pretty options for use with file output + * + * @source + * */ export const prettyFile: PrettyOptions = prettyOptsFactory({ colorize: false, sync: false,