@geekmidas/logger 0.0.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +114 -7
  2. package/dist/console.cjs +75 -17
  3. package/dist/console.cjs.map +1 -1
  4. package/dist/console.d.cts +31 -7
  5. package/dist/console.d.mts +31 -7
  6. package/dist/console.mjs +76 -18
  7. package/dist/console.mjs.map +1 -1
  8. package/dist/index.d.cts +2 -2
  9. package/dist/index.d.mts +2 -2
  10. package/dist/pino.cjs +42 -1
  11. package/dist/pino.cjs.map +1 -1
  12. package/dist/pino.d.cts +23 -3
  13. package/dist/pino.d.mts +23 -3
  14. package/dist/pino.mjs +42 -2
  15. package/dist/pino.mjs.map +1 -1
  16. package/dist/redact-paths-Br-tI2GZ.d.cts +18 -0
  17. package/dist/redact-paths-CIsuxHH7.d.mts +18 -0
  18. package/dist/redact-paths-D0m0DIuQ.cjs +73 -0
  19. package/dist/redact-paths-D0m0DIuQ.cjs.map +1 -0
  20. package/dist/redact-paths-DQoIXhkS.mjs +67 -0
  21. package/dist/redact-paths-DQoIXhkS.mjs.map +1 -0
  22. package/dist/redact-paths.cjs +3 -0
  23. package/dist/redact-paths.d.cts +2 -0
  24. package/dist/redact-paths.d.mts +2 -0
  25. package/dist/redact-paths.mjs +3 -0
  26. package/dist/{types-C1RfRbo6.d.mts → types-Bga8WDuP.d.mts} +86 -2
  27. package/dist/{types-DXdmn7h5.d.cts → types-JxCFymH0.d.cts} +86 -2
  28. package/dist/types-ag_0Cvbg.cjs.map +1 -1
  29. package/dist/types-yQ6XOihF.mjs.map +1 -1
  30. package/dist/types.d.cts +2 -2
  31. package/dist/types.d.mts +2 -2
  32. package/package.json +10 -1
  33. package/src/__tests__/console.spec.ts +277 -140
  34. package/src/__tests__/pino-redaction.integration.spec.ts +307 -0
  35. package/src/__tests__/pino.spec.ts +199 -0
  36. package/src/console.ts +95 -23
  37. package/src/index.ts +1 -0
  38. package/src/pino.ts +105 -2
  39. package/src/redact-paths.ts +71 -0
  40. package/src/types.ts +87 -0
package/dist/index.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { CreateLoggerOptions, LogFn, LogLevel, Logger } from "./types-DXdmn7h5.cjs";
2
- export { CreateLoggerOptions, LogFn, LogLevel, Logger };
1
+ import { CreateLoggerOptions, LogFn, LogLevel, Logger, RedactOptions } from "./types-JxCFymH0.cjs";
2
+ export { CreateLoggerOptions, LogFn, LogLevel, Logger, RedactOptions };
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { CreateLoggerOptions, LogFn, LogLevel, Logger } from "./types-C1RfRbo6.mjs";
2
- export { CreateLoggerOptions, LogFn, LogLevel, Logger };
1
+ import { CreateLoggerOptions, LogFn, LogLevel, Logger, RedactOptions } from "./types-Bga8WDuP.mjs";
2
+ export { CreateLoggerOptions, LogFn, LogLevel, Logger, RedactOptions };
package/dist/pino.cjs CHANGED
@@ -21,17 +21,57 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  }) : target, mod));
22
22
 
23
23
  //#endregion
24
+ const require_redact_paths = require('./redact-paths-D0m0DIuQ.cjs');
24
25
  const pino = __toESM(require("pino"));
25
26
 
26
27
  //#region src/pino.ts
27
- function createLogger(options) {
28
+ /**
29
+ * Resolves redaction configuration from options.
30
+ * Returns undefined if redaction is disabled, or a pino-compatible redact config.
31
+ *
32
+ * By default (resolution: 'merge'), custom paths are merged with DEFAULT_REDACT_PATHS.
33
+ * With resolution: 'override', only the custom paths are used.
34
+ */
35
+ function resolveRedactConfig(redact) {
36
+ if (redact === void 0 || redact === false) return void 0;
37
+ if (redact === true) return require_redact_paths.DEFAULT_REDACT_PATHS;
38
+ if (Array.isArray(redact)) return [...require_redact_paths.DEFAULT_REDACT_PATHS, ...redact];
39
+ const { resolution = "merge", paths, censor, remove } = redact;
40
+ const resolvedPaths = resolution === "override" ? paths : [...require_redact_paths.DEFAULT_REDACT_PATHS, ...paths];
41
+ const config = { paths: resolvedPaths };
42
+ if (censor !== void 0) config.censor = censor;
43
+ if (remove !== void 0) config.remove = remove;
44
+ return config;
45
+ }
46
+ /**
47
+ * Creates a pino logger instance with optional redaction support.
48
+ *
49
+ * @param options - Logger configuration options
50
+ * @returns A configured pino logger instance
51
+ *
52
+ * @example
53
+ * ```typescript
54
+ * // Basic logger
55
+ * const logger = createLogger({ level: 'debug' });
56
+ *
57
+ * // With redaction enabled
58
+ * const secureLogger = createLogger({ redact: true });
59
+ *
60
+ * // Pretty printing in development
61
+ * const devLogger = createLogger({ pretty: true, redact: true });
62
+ * ```
63
+ */
64
+ function createLogger(options = {}) {
28
65
  const pretty = options?.pretty && process.NODE_ENV !== "production";
29
66
  const baseOptions = pretty ? { transport: {
30
67
  target: "pino-pretty",
31
68
  options: { colorize: true }
32
69
  } } : {};
70
+ const redact = resolveRedactConfig(options.redact);
33
71
  return (0, pino.pino)({
34
72
  ...baseOptions,
73
+ ...options.level && { level: options.level },
74
+ ...redact && { redact },
35
75
  formatters: {
36
76
  bindings() {
37
77
  return { nodeVersion: process.version };
@@ -44,5 +84,6 @@ function createLogger(options) {
44
84
  }
45
85
 
46
86
  //#endregion
87
+ exports.DEFAULT_REDACT_PATHS = require_redact_paths.DEFAULT_REDACT_PATHS;
47
88
  exports.createLogger = createLogger;
48
89
  //# sourceMappingURL=pino.cjs.map
package/dist/pino.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"pino.cjs","names":["options: CreateLoggerOptions"],"sources":["../src/pino.ts"],"sourcesContent":["import { pino } from 'pino';\nimport type { CreateLoggerOptions } from './types';\n\nexport function createLogger(options: CreateLoggerOptions) {\n // @ts-ignore\n const pretty = options?.pretty && process.NODE_ENV !== 'production';\n const baseOptions = pretty\n ? {\n transport: {\n target: 'pino-pretty',\n options: { colorize: true },\n },\n }\n : {};\n return pino({\n ...baseOptions,\n formatters: {\n bindings() {\n return { nodeVersion: process.version };\n },\n level: (label) => {\n return { level: label.toUpperCase() };\n },\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAgB,aAAaA,SAA8B;CAEzD,MAAM,SAAS,SAAS,UAAU,QAAQ,aAAa;CACvD,MAAM,cAAc,SAChB,EACE,WAAW;EACT,QAAQ;EACR,SAAS,EAAE,UAAU,KAAM;CAC5B,EACF,IACD,CAAE;AACN,QAAO,eAAK;EACV,GAAG;EACH,YAAY;GACV,WAAW;AACT,WAAO,EAAE,aAAa,QAAQ,QAAS;GACxC;GACD,OAAO,CAAC,UAAU;AAChB,WAAO,EAAE,OAAO,MAAM,aAAa,CAAE;GACtC;EACF;CACF,EAAC;AACH"}
1
+ {"version":3,"file":"pino.cjs","names":["redact: boolean | RedactOptions | undefined","DEFAULT_REDACT_PATHS","config: PinoRedactConfig","options: CreateLoggerOptions"],"sources":["../src/pino.ts"],"sourcesContent":["/**\n * Pino logger with built-in redaction support for sensitive data.\n *\n * @example\n * ```typescript\n * import { createLogger, DEFAULT_REDACT_PATHS } from '@geekmidas/logger/pino';\n *\n * // Enable redaction with sensible defaults\n * const logger = createLogger({ redact: true });\n *\n * // Sensitive data is automatically masked\n * logger.info({ password: 'secret123', user: 'john' }, 'Login');\n * // Output: { password: '[Redacted]', user: 'john' } Login\n *\n * // Add custom paths (merged with defaults)\n * const logger2 = createLogger({ redact: ['user.ssn'] });\n *\n * // Override defaults for full control\n * const logger3 = createLogger({\n * redact: {\n * paths: ['onlyThis'],\n * resolution: 'override',\n * }\n * });\n * ```\n *\n * @module\n */\nimport { pino } from 'pino';\nimport { DEFAULT_REDACT_PATHS } from './redact-paths';\nimport type { CreateLoggerOptions, RedactOptions } from './types';\n\n// Re-export for backwards compatibility\nexport { DEFAULT_REDACT_PATHS } from './redact-paths';\n\n/**\n * Type for the resolved pino redact config (without our custom resolution field).\n */\ntype PinoRedactConfig =\n | string[]\n | {\n paths: string[];\n censor?: string | ((value: unknown, path: string[]) => unknown);\n remove?: boolean;\n };\n\n/**\n * Resolves redaction configuration from options.\n * Returns undefined if redaction is disabled, or a pino-compatible redact config.\n *\n * By default (resolution: 'merge'), custom paths are merged with DEFAULT_REDACT_PATHS.\n * With resolution: 'override', only the custom paths are used.\n */\nfunction resolveRedactConfig(\n redact: boolean | RedactOptions | undefined,\n): PinoRedactConfig | undefined {\n if (redact === undefined || redact === false) {\n return undefined;\n }\n\n if (redact === true) {\n return DEFAULT_REDACT_PATHS;\n }\n\n // Array syntax - merge with defaults\n if (Array.isArray(redact)) {\n return [...DEFAULT_REDACT_PATHS, ...redact];\n }\n\n // Object syntax - check resolution mode\n const { resolution = 'merge', paths, censor, remove } = redact;\n\n const resolvedPaths =\n resolution === 'override' ? paths : [...DEFAULT_REDACT_PATHS, ...paths];\n\n // Return clean pino config without our resolution field\n const config: PinoRedactConfig = { paths: resolvedPaths };\n if (censor !== undefined) config.censor = censor;\n if (remove !== undefined) config.remove = remove;\n\n return config;\n}\n\n/**\n * Creates a pino logger instance with optional redaction support.\n *\n * @param options - Logger configuration options\n * @returns A configured pino logger instance\n *\n * @example\n * ```typescript\n * // Basic logger\n * const logger = createLogger({ level: 'debug' });\n *\n * // With redaction enabled\n * const secureLogger = createLogger({ redact: true });\n *\n * // Pretty printing in development\n * const devLogger = createLogger({ pretty: true, redact: true });\n * ```\n */\nexport function createLogger(options: CreateLoggerOptions = {}) {\n // @ts-ignore\n const pretty = options?.pretty && process.NODE_ENV !== 'production';\n const baseOptions = pretty\n ? {\n transport: {\n target: 'pino-pretty',\n options: { colorize: true },\n },\n }\n : {};\n\n const redact = resolveRedactConfig(options.redact);\n\n return pino({\n ...baseOptions,\n ...(options.level && { level: options.level }),\n ...(redact && { redact }),\n formatters: {\n bindings() {\n return { nodeVersion: process.version };\n },\n level: (label) => {\n return { level: label.toUpperCase() };\n },\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,SAAS,oBACPA,QAC8B;AAC9B,KAAI,qBAAwB,WAAW,MACrC;AAGF,KAAI,WAAW,KACb,QAAOC;AAIT,KAAI,MAAM,QAAQ,OAAO,CACvB,QAAO,CAAC,GAAGA,2CAAsB,GAAG,MAAO;CAI7C,MAAM,EAAE,aAAa,SAAS,OAAO,QAAQ,QAAQ,GAAG;CAExD,MAAM,gBACJ,eAAe,aAAa,QAAQ,CAAC,GAAGA,2CAAsB,GAAG,KAAM;CAGzE,MAAMC,SAA2B,EAAE,OAAO,cAAe;AACzD,KAAI,kBAAsB,QAAO,SAAS;AAC1C,KAAI,kBAAsB,QAAO,SAAS;AAE1C,QAAO;AACR;;;;;;;;;;;;;;;;;;;AAoBD,SAAgB,aAAaC,UAA+B,CAAE,GAAE;CAE9D,MAAM,SAAS,SAAS,UAAU,QAAQ,aAAa;CACvD,MAAM,cAAc,SAChB,EACE,WAAW;EACT,QAAQ;EACR,SAAS,EAAE,UAAU,KAAM;CAC5B,EACF,IACD,CAAE;CAEN,MAAM,SAAS,oBAAoB,QAAQ,OAAO;AAElD,QAAO,eAAK;EACV,GAAG;EACH,GAAI,QAAQ,SAAS,EAAE,OAAO,QAAQ,MAAO;EAC7C,GAAI,UAAU,EAAE,OAAQ;EACxB,YAAY;GACV,WAAW;AACT,WAAO,EAAE,aAAa,QAAQ,QAAS;GACxC;GACD,OAAO,CAAC,UAAU;AAChB,WAAO,EAAE,OAAO,MAAM,aAAa,CAAE;GACtC;EACF;CACF,EAAC;AACH"}
package/dist/pino.d.cts CHANGED
@@ -1,8 +1,28 @@
1
- import { CreateLoggerOptions } from "./types-DXdmn7h5.cjs";
1
+ import { CreateLoggerOptions } from "./types-JxCFymH0.cjs";
2
+ import { DEFAULT_REDACT_PATHS } from "./redact-paths-Br-tI2GZ.cjs";
2
3
  import * as pino0 from "pino";
3
4
 
4
5
  //#region src/pino.d.ts
5
- declare function createLogger(options: CreateLoggerOptions): pino0.Logger<never, boolean>;
6
+
7
+ /**
8
+ * Creates a pino logger instance with optional redaction support.
9
+ *
10
+ * @param options - Logger configuration options
11
+ * @returns A configured pino logger instance
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * // Basic logger
16
+ * const logger = createLogger({ level: 'debug' });
17
+ *
18
+ * // With redaction enabled
19
+ * const secureLogger = createLogger({ redact: true });
20
+ *
21
+ * // Pretty printing in development
22
+ * const devLogger = createLogger({ pretty: true, redact: true });
23
+ * ```
24
+ */
25
+ declare function createLogger(options?: CreateLoggerOptions): pino0.Logger<never, boolean>;
6
26
  //#endregion
7
- export { createLogger };
27
+ export { DEFAULT_REDACT_PATHS, createLogger };
8
28
  //# sourceMappingURL=pino.d.cts.map
package/dist/pino.d.mts CHANGED
@@ -1,8 +1,28 @@
1
- import { CreateLoggerOptions } from "./types-C1RfRbo6.mjs";
1
+ import { CreateLoggerOptions } from "./types-Bga8WDuP.mjs";
2
+ import { DEFAULT_REDACT_PATHS } from "./redact-paths-CIsuxHH7.mjs";
2
3
  import * as pino0 from "pino";
3
4
 
4
5
  //#region src/pino.d.ts
5
- declare function createLogger(options: CreateLoggerOptions): pino0.Logger<never, boolean>;
6
+
7
+ /**
8
+ * Creates a pino logger instance with optional redaction support.
9
+ *
10
+ * @param options - Logger configuration options
11
+ * @returns A configured pino logger instance
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * // Basic logger
16
+ * const logger = createLogger({ level: 'debug' });
17
+ *
18
+ * // With redaction enabled
19
+ * const secureLogger = createLogger({ redact: true });
20
+ *
21
+ * // Pretty printing in development
22
+ * const devLogger = createLogger({ pretty: true, redact: true });
23
+ * ```
24
+ */
25
+ declare function createLogger(options?: CreateLoggerOptions): pino0.Logger<never, boolean>;
6
26
  //#endregion
7
- export { createLogger };
27
+ export { DEFAULT_REDACT_PATHS, createLogger };
8
28
  //# sourceMappingURL=pino.d.mts.map
package/dist/pino.mjs CHANGED
@@ -1,14 +1,54 @@
1
+ import { DEFAULT_REDACT_PATHS } from "./redact-paths-DQoIXhkS.mjs";
1
2
  import { pino } from "pino";
2
3
 
3
4
  //#region src/pino.ts
4
- function createLogger(options) {
5
+ /**
6
+ * Resolves redaction configuration from options.
7
+ * Returns undefined if redaction is disabled, or a pino-compatible redact config.
8
+ *
9
+ * By default (resolution: 'merge'), custom paths are merged with DEFAULT_REDACT_PATHS.
10
+ * With resolution: 'override', only the custom paths are used.
11
+ */
12
+ function resolveRedactConfig(redact) {
13
+ if (redact === void 0 || redact === false) return void 0;
14
+ if (redact === true) return DEFAULT_REDACT_PATHS;
15
+ if (Array.isArray(redact)) return [...DEFAULT_REDACT_PATHS, ...redact];
16
+ const { resolution = "merge", paths, censor, remove } = redact;
17
+ const resolvedPaths = resolution === "override" ? paths : [...DEFAULT_REDACT_PATHS, ...paths];
18
+ const config = { paths: resolvedPaths };
19
+ if (censor !== void 0) config.censor = censor;
20
+ if (remove !== void 0) config.remove = remove;
21
+ return config;
22
+ }
23
+ /**
24
+ * Creates a pino logger instance with optional redaction support.
25
+ *
26
+ * @param options - Logger configuration options
27
+ * @returns A configured pino logger instance
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * // Basic logger
32
+ * const logger = createLogger({ level: 'debug' });
33
+ *
34
+ * // With redaction enabled
35
+ * const secureLogger = createLogger({ redact: true });
36
+ *
37
+ * // Pretty printing in development
38
+ * const devLogger = createLogger({ pretty: true, redact: true });
39
+ * ```
40
+ */
41
+ function createLogger(options = {}) {
5
42
  const pretty = options?.pretty && process.NODE_ENV !== "production";
6
43
  const baseOptions = pretty ? { transport: {
7
44
  target: "pino-pretty",
8
45
  options: { colorize: true }
9
46
  } } : {};
47
+ const redact = resolveRedactConfig(options.redact);
10
48
  return pino({
11
49
  ...baseOptions,
50
+ ...options.level && { level: options.level },
51
+ ...redact && { redact },
12
52
  formatters: {
13
53
  bindings() {
14
54
  return { nodeVersion: process.version };
@@ -21,5 +61,5 @@ function createLogger(options) {
21
61
  }
22
62
 
23
63
  //#endregion
24
- export { createLogger };
64
+ export { DEFAULT_REDACT_PATHS, createLogger };
25
65
  //# sourceMappingURL=pino.mjs.map
package/dist/pino.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"pino.mjs","names":["options: CreateLoggerOptions"],"sources":["../src/pino.ts"],"sourcesContent":["import { pino } from 'pino';\nimport type { CreateLoggerOptions } from './types';\n\nexport function createLogger(options: CreateLoggerOptions) {\n // @ts-ignore\n const pretty = options?.pretty && process.NODE_ENV !== 'production';\n const baseOptions = pretty\n ? {\n transport: {\n target: 'pino-pretty',\n options: { colorize: true },\n },\n }\n : {};\n return pino({\n ...baseOptions,\n formatters: {\n bindings() {\n return { nodeVersion: process.version };\n },\n level: (label) => {\n return { level: label.toUpperCase() };\n },\n },\n });\n}\n"],"mappings":";;;AAGA,SAAgB,aAAaA,SAA8B;CAEzD,MAAM,SAAS,SAAS,UAAU,QAAQ,aAAa;CACvD,MAAM,cAAc,SAChB,EACE,WAAW;EACT,QAAQ;EACR,SAAS,EAAE,UAAU,KAAM;CAC5B,EACF,IACD,CAAE;AACN,QAAO,KAAK;EACV,GAAG;EACH,YAAY;GACV,WAAW;AACT,WAAO,EAAE,aAAa,QAAQ,QAAS;GACxC;GACD,OAAO,CAAC,UAAU;AAChB,WAAO,EAAE,OAAO,MAAM,aAAa,CAAE;GACtC;EACF;CACF,EAAC;AACH"}
1
+ {"version":3,"file":"pino.mjs","names":["redact: boolean | RedactOptions | undefined","config: PinoRedactConfig","options: CreateLoggerOptions"],"sources":["../src/pino.ts"],"sourcesContent":["/**\n * Pino logger with built-in redaction support for sensitive data.\n *\n * @example\n * ```typescript\n * import { createLogger, DEFAULT_REDACT_PATHS } from '@geekmidas/logger/pino';\n *\n * // Enable redaction with sensible defaults\n * const logger = createLogger({ redact: true });\n *\n * // Sensitive data is automatically masked\n * logger.info({ password: 'secret123', user: 'john' }, 'Login');\n * // Output: { password: '[Redacted]', user: 'john' } Login\n *\n * // Add custom paths (merged with defaults)\n * const logger2 = createLogger({ redact: ['user.ssn'] });\n *\n * // Override defaults for full control\n * const logger3 = createLogger({\n * redact: {\n * paths: ['onlyThis'],\n * resolution: 'override',\n * }\n * });\n * ```\n *\n * @module\n */\nimport { pino } from 'pino';\nimport { DEFAULT_REDACT_PATHS } from './redact-paths';\nimport type { CreateLoggerOptions, RedactOptions } from './types';\n\n// Re-export for backwards compatibility\nexport { DEFAULT_REDACT_PATHS } from './redact-paths';\n\n/**\n * Type for the resolved pino redact config (without our custom resolution field).\n */\ntype PinoRedactConfig =\n | string[]\n | {\n paths: string[];\n censor?: string | ((value: unknown, path: string[]) => unknown);\n remove?: boolean;\n };\n\n/**\n * Resolves redaction configuration from options.\n * Returns undefined if redaction is disabled, or a pino-compatible redact config.\n *\n * By default (resolution: 'merge'), custom paths are merged with DEFAULT_REDACT_PATHS.\n * With resolution: 'override', only the custom paths are used.\n */\nfunction resolveRedactConfig(\n redact: boolean | RedactOptions | undefined,\n): PinoRedactConfig | undefined {\n if (redact === undefined || redact === false) {\n return undefined;\n }\n\n if (redact === true) {\n return DEFAULT_REDACT_PATHS;\n }\n\n // Array syntax - merge with defaults\n if (Array.isArray(redact)) {\n return [...DEFAULT_REDACT_PATHS, ...redact];\n }\n\n // Object syntax - check resolution mode\n const { resolution = 'merge', paths, censor, remove } = redact;\n\n const resolvedPaths =\n resolution === 'override' ? paths : [...DEFAULT_REDACT_PATHS, ...paths];\n\n // Return clean pino config without our resolution field\n const config: PinoRedactConfig = { paths: resolvedPaths };\n if (censor !== undefined) config.censor = censor;\n if (remove !== undefined) config.remove = remove;\n\n return config;\n}\n\n/**\n * Creates a pino logger instance with optional redaction support.\n *\n * @param options - Logger configuration options\n * @returns A configured pino logger instance\n *\n * @example\n * ```typescript\n * // Basic logger\n * const logger = createLogger({ level: 'debug' });\n *\n * // With redaction enabled\n * const secureLogger = createLogger({ redact: true });\n *\n * // Pretty printing in development\n * const devLogger = createLogger({ pretty: true, redact: true });\n * ```\n */\nexport function createLogger(options: CreateLoggerOptions = {}) {\n // @ts-ignore\n const pretty = options?.pretty && process.NODE_ENV !== 'production';\n const baseOptions = pretty\n ? {\n transport: {\n target: 'pino-pretty',\n options: { colorize: true },\n },\n }\n : {};\n\n const redact = resolveRedactConfig(options.redact);\n\n return pino({\n ...baseOptions,\n ...(options.level && { level: options.level }),\n ...(redact && { redact }),\n formatters: {\n bindings() {\n return { nodeVersion: process.version };\n },\n level: (label) => {\n return { level: label.toUpperCase() };\n },\n },\n });\n}\n"],"mappings":";;;;;;;;;;;AAqDA,SAAS,oBACPA,QAC8B;AAC9B,KAAI,qBAAwB,WAAW,MACrC;AAGF,KAAI,WAAW,KACb,QAAO;AAIT,KAAI,MAAM,QAAQ,OAAO,CACvB,QAAO,CAAC,GAAG,sBAAsB,GAAG,MAAO;CAI7C,MAAM,EAAE,aAAa,SAAS,OAAO,QAAQ,QAAQ,GAAG;CAExD,MAAM,gBACJ,eAAe,aAAa,QAAQ,CAAC,GAAG,sBAAsB,GAAG,KAAM;CAGzE,MAAMC,SAA2B,EAAE,OAAO,cAAe;AACzD,KAAI,kBAAsB,QAAO,SAAS;AAC1C,KAAI,kBAAsB,QAAO,SAAS;AAE1C,QAAO;AACR;;;;;;;;;;;;;;;;;;;AAoBD,SAAgB,aAAaC,UAA+B,CAAE,GAAE;CAE9D,MAAM,SAAS,SAAS,UAAU,QAAQ,aAAa;CACvD,MAAM,cAAc,SAChB,EACE,WAAW;EACT,QAAQ;EACR,SAAS,EAAE,UAAU,KAAM;CAC5B,EACF,IACD,CAAE;CAEN,MAAM,SAAS,oBAAoB,QAAQ,OAAO;AAElD,QAAO,KAAK;EACV,GAAG;EACH,GAAI,QAAQ,SAAS,EAAE,OAAO,QAAQ,MAAO;EAC7C,GAAI,UAAU,EAAE,OAAQ;EACxB,YAAY;GACV,WAAW;AACT,WAAO,EAAE,aAAa,QAAQ,QAAS;GACxC;GACD,OAAO,CAAC,UAAU;AAChB,WAAO,EAAE,OAAO,MAAM,aAAa,CAAE;GACtC;EACF;CACF,EAAC;AACH"}
@@ -0,0 +1,18 @@
1
+ //#region src/redact-paths.d.ts
2
+ /**
3
+ * Default sensitive field paths for redaction.
4
+ *
5
+ * These paths are automatically used when `redact: true` is set,
6
+ * and merged with custom paths unless `resolution: 'override'` is specified.
7
+ *
8
+ * Includes:
9
+ * - Authentication: password, token, apiKey, authorization, credentials
10
+ * - Headers: authorization, cookie, x-api-key, x-auth-token
11
+ * - Personal data: ssn, creditCard, cvv, pin
12
+ * - Secrets: secret, connectionString, databaseUrl
13
+ * - Wildcards: *.password, *.secret, *.token (catches nested fields)
14
+ */
15
+ declare const DEFAULT_REDACT_PATHS: string[];
16
+ //#endregion
17
+ export { DEFAULT_REDACT_PATHS };
18
+ //# sourceMappingURL=redact-paths-Br-tI2GZ.d.cts.map
@@ -0,0 +1,18 @@
1
+ //#region src/redact-paths.d.ts
2
+ /**
3
+ * Default sensitive field paths for redaction.
4
+ *
5
+ * These paths are automatically used when `redact: true` is set,
6
+ * and merged with custom paths unless `resolution: 'override'` is specified.
7
+ *
8
+ * Includes:
9
+ * - Authentication: password, token, apiKey, authorization, credentials
10
+ * - Headers: authorization, cookie, x-api-key, x-auth-token
11
+ * - Personal data: ssn, creditCard, cvv, pin
12
+ * - Secrets: secret, connectionString, databaseUrl
13
+ * - Wildcards: *.password, *.secret, *.token (catches nested fields)
14
+ */
15
+ declare const DEFAULT_REDACT_PATHS: string[];
16
+ //#endregion
17
+ export { DEFAULT_REDACT_PATHS };
18
+ //# sourceMappingURL=redact-paths-CIsuxHH7.d.mts.map
@@ -0,0 +1,73 @@
1
+
2
+ //#region src/redact-paths.ts
3
+ /**
4
+ * Default sensitive field paths for redaction.
5
+ *
6
+ * These paths are automatically used when `redact: true` is set,
7
+ * and merged with custom paths unless `resolution: 'override'` is specified.
8
+ *
9
+ * Includes:
10
+ * - Authentication: password, token, apiKey, authorization, credentials
11
+ * - Headers: authorization, cookie, x-api-key, x-auth-token
12
+ * - Personal data: ssn, creditCard, cvv, pin
13
+ * - Secrets: secret, connectionString, databaseUrl
14
+ * - Wildcards: *.password, *.secret, *.token (catches nested fields)
15
+ */
16
+ const DEFAULT_REDACT_PATHS = [
17
+ "password",
18
+ "pass",
19
+ "passwd",
20
+ "secret",
21
+ "token",
22
+ "accessToken",
23
+ "refreshToken",
24
+ "idToken",
25
+ "apiKey",
26
+ "api_key",
27
+ "apikey",
28
+ "auth",
29
+ "authorization",
30
+ "credential",
31
+ "credentials",
32
+ "*.password",
33
+ "*.secret",
34
+ "*.token",
35
+ "*.apiKey",
36
+ "*.api_key",
37
+ "*.authorization",
38
+ "*.accessToken",
39
+ "*.refreshToken",
40
+ "headers.authorization",
41
+ "headers.Authorization",
42
+ "headers[\"authorization\"]",
43
+ "headers[\"Authorization\"]",
44
+ "headers.cookie",
45
+ "headers.Cookie",
46
+ "headers[\"x-api-key\"]",
47
+ "headers[\"X-Api-Key\"]",
48
+ "headers[\"x-auth-token\"]",
49
+ "headers[\"X-Auth-Token\"]",
50
+ "ssn",
51
+ "socialSecurityNumber",
52
+ "social_security_number",
53
+ "creditCard",
54
+ "credit_card",
55
+ "cardNumber",
56
+ "card_number",
57
+ "cvv",
58
+ "cvc",
59
+ "pin",
60
+ "connectionString",
61
+ "connection_string",
62
+ "databaseUrl",
63
+ "database_url"
64
+ ];
65
+
66
+ //#endregion
67
+ Object.defineProperty(exports, 'DEFAULT_REDACT_PATHS', {
68
+ enumerable: true,
69
+ get: function () {
70
+ return DEFAULT_REDACT_PATHS;
71
+ }
72
+ });
73
+ //# sourceMappingURL=redact-paths-D0m0DIuQ.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redact-paths-D0m0DIuQ.cjs","names":["DEFAULT_REDACT_PATHS: string[]"],"sources":["../src/redact-paths.ts"],"sourcesContent":["/**\n * Default sensitive field paths for redaction.\n *\n * These paths are automatically used when `redact: true` is set,\n * and merged with custom paths unless `resolution: 'override'` is specified.\n *\n * Includes:\n * - Authentication: password, token, apiKey, authorization, credentials\n * - Headers: authorization, cookie, x-api-key, x-auth-token\n * - Personal data: ssn, creditCard, cvv, pin\n * - Secrets: secret, connectionString, databaseUrl\n * - Wildcards: *.password, *.secret, *.token (catches nested fields)\n */\nexport const DEFAULT_REDACT_PATHS: string[] = [\n // Authentication & authorization\n 'password',\n 'pass',\n 'passwd',\n 'secret',\n 'token',\n 'accessToken',\n 'refreshToken',\n 'idToken',\n 'apiKey',\n 'api_key',\n 'apikey',\n 'auth',\n 'authorization',\n 'credential',\n 'credentials',\n\n // Common nested patterns (headers, body, etc.)\n '*.password',\n '*.secret',\n '*.token',\n '*.apiKey',\n '*.api_key',\n '*.authorization',\n '*.accessToken',\n '*.refreshToken',\n\n // HTTP headers (case variations)\n 'headers.authorization',\n 'headers.Authorization',\n 'headers[\"authorization\"]',\n 'headers[\"Authorization\"]',\n 'headers.cookie',\n 'headers.Cookie',\n 'headers[\"x-api-key\"]',\n 'headers[\"X-Api-Key\"]',\n 'headers[\"x-auth-token\"]',\n 'headers[\"X-Auth-Token\"]',\n\n // Common sensitive data fields\n 'ssn',\n 'socialSecurityNumber',\n 'social_security_number',\n 'creditCard',\n 'credit_card',\n 'cardNumber',\n 'card_number',\n 'cvv',\n 'cvc',\n 'pin',\n\n // Database & connection strings\n 'connectionString',\n 'connection_string',\n 'databaseUrl',\n 'database_url',\n];\n"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAaA,uBAAiC;CAE5C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;AACD"}
@@ -0,0 +1,67 @@
1
+ //#region src/redact-paths.ts
2
+ /**
3
+ * Default sensitive field paths for redaction.
4
+ *
5
+ * These paths are automatically used when `redact: true` is set,
6
+ * and merged with custom paths unless `resolution: 'override'` is specified.
7
+ *
8
+ * Includes:
9
+ * - Authentication: password, token, apiKey, authorization, credentials
10
+ * - Headers: authorization, cookie, x-api-key, x-auth-token
11
+ * - Personal data: ssn, creditCard, cvv, pin
12
+ * - Secrets: secret, connectionString, databaseUrl
13
+ * - Wildcards: *.password, *.secret, *.token (catches nested fields)
14
+ */
15
+ const DEFAULT_REDACT_PATHS = [
16
+ "password",
17
+ "pass",
18
+ "passwd",
19
+ "secret",
20
+ "token",
21
+ "accessToken",
22
+ "refreshToken",
23
+ "idToken",
24
+ "apiKey",
25
+ "api_key",
26
+ "apikey",
27
+ "auth",
28
+ "authorization",
29
+ "credential",
30
+ "credentials",
31
+ "*.password",
32
+ "*.secret",
33
+ "*.token",
34
+ "*.apiKey",
35
+ "*.api_key",
36
+ "*.authorization",
37
+ "*.accessToken",
38
+ "*.refreshToken",
39
+ "headers.authorization",
40
+ "headers.Authorization",
41
+ "headers[\"authorization\"]",
42
+ "headers[\"Authorization\"]",
43
+ "headers.cookie",
44
+ "headers.Cookie",
45
+ "headers[\"x-api-key\"]",
46
+ "headers[\"X-Api-Key\"]",
47
+ "headers[\"x-auth-token\"]",
48
+ "headers[\"X-Auth-Token\"]",
49
+ "ssn",
50
+ "socialSecurityNumber",
51
+ "social_security_number",
52
+ "creditCard",
53
+ "credit_card",
54
+ "cardNumber",
55
+ "card_number",
56
+ "cvv",
57
+ "cvc",
58
+ "pin",
59
+ "connectionString",
60
+ "connection_string",
61
+ "databaseUrl",
62
+ "database_url"
63
+ ];
64
+
65
+ //#endregion
66
+ export { DEFAULT_REDACT_PATHS };
67
+ //# sourceMappingURL=redact-paths-DQoIXhkS.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redact-paths-DQoIXhkS.mjs","names":["DEFAULT_REDACT_PATHS: string[]"],"sources":["../src/redact-paths.ts"],"sourcesContent":["/**\n * Default sensitive field paths for redaction.\n *\n * These paths are automatically used when `redact: true` is set,\n * and merged with custom paths unless `resolution: 'override'` is specified.\n *\n * Includes:\n * - Authentication: password, token, apiKey, authorization, credentials\n * - Headers: authorization, cookie, x-api-key, x-auth-token\n * - Personal data: ssn, creditCard, cvv, pin\n * - Secrets: secret, connectionString, databaseUrl\n * - Wildcards: *.password, *.secret, *.token (catches nested fields)\n */\nexport const DEFAULT_REDACT_PATHS: string[] = [\n // Authentication & authorization\n 'password',\n 'pass',\n 'passwd',\n 'secret',\n 'token',\n 'accessToken',\n 'refreshToken',\n 'idToken',\n 'apiKey',\n 'api_key',\n 'apikey',\n 'auth',\n 'authorization',\n 'credential',\n 'credentials',\n\n // Common nested patterns (headers, body, etc.)\n '*.password',\n '*.secret',\n '*.token',\n '*.apiKey',\n '*.api_key',\n '*.authorization',\n '*.accessToken',\n '*.refreshToken',\n\n // HTTP headers (case variations)\n 'headers.authorization',\n 'headers.Authorization',\n 'headers[\"authorization\"]',\n 'headers[\"Authorization\"]',\n 'headers.cookie',\n 'headers.Cookie',\n 'headers[\"x-api-key\"]',\n 'headers[\"X-Api-Key\"]',\n 'headers[\"x-auth-token\"]',\n 'headers[\"X-Auth-Token\"]',\n\n // Common sensitive data fields\n 'ssn',\n 'socialSecurityNumber',\n 'social_security_number',\n 'creditCard',\n 'credit_card',\n 'cardNumber',\n 'card_number',\n 'cvv',\n 'cvc',\n 'pin',\n\n // Database & connection strings\n 'connectionString',\n 'connection_string',\n 'databaseUrl',\n 'database_url',\n];\n"],"mappings":";;;;;;;;;;;;;;AAaA,MAAaA,uBAAiC;CAE5C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;AACD"}
@@ -0,0 +1,3 @@
1
+ const require_redact_paths = require('./redact-paths-D0m0DIuQ.cjs');
2
+
3
+ exports.DEFAULT_REDACT_PATHS = require_redact_paths.DEFAULT_REDACT_PATHS;
@@ -0,0 +1,2 @@
1
+ import { DEFAULT_REDACT_PATHS } from "./redact-paths-Br-tI2GZ.cjs";
2
+ export { DEFAULT_REDACT_PATHS };
@@ -0,0 +1,2 @@
1
+ import { DEFAULT_REDACT_PATHS } from "./redact-paths-CIsuxHH7.mjs";
2
+ export { DEFAULT_REDACT_PATHS };
@@ -0,0 +1,3 @@
1
+ import { DEFAULT_REDACT_PATHS } from "./redact-paths-DQoIXhkS.mjs";
2
+
3
+ export { DEFAULT_REDACT_PATHS };
@@ -72,10 +72,94 @@ declare enum LogLevel {
72
72
  Fatal = "fatal",
73
73
  Silent = "silent",
74
74
  }
75
+ /**
76
+ * Redaction configuration for masking sensitive data in logs.
77
+ * Uses pino's fast-redact library under the hood.
78
+ *
79
+ * By default, custom paths are merged with the default sensitive paths.
80
+ * Use `resolution: 'override'` to use only your custom paths.
81
+ *
82
+ * @example
83
+ * ```typescript
84
+ * // Simple path array (merges with defaults)
85
+ * redact: ['user.ssn', 'custom.field']
86
+ *
87
+ * // Override defaults completely
88
+ * redact: {
89
+ * paths: ['only.these.paths'],
90
+ * resolution: 'override',
91
+ * }
92
+ *
93
+ * // With custom censor
94
+ * redact: {
95
+ * paths: ['extra.secret'],
96
+ * censor: '***',
97
+ * }
98
+ *
99
+ * // Remove fields entirely
100
+ * redact: {
101
+ * paths: ['temporary.data'],
102
+ * remove: true,
103
+ * }
104
+ * ```
105
+ */
106
+ type RedactOptions = string[] | {
107
+ /** Paths to redact using dot notation or bracket notation for special chars */
108
+ paths: string[];
109
+ /** Custom replacement text (default: '[REDACTED]') */
110
+ censor?: string | ((value: unknown, path: string[]) => unknown);
111
+ /** Remove the field entirely instead of replacing (default: false) */
112
+ remove?: boolean;
113
+ /**
114
+ * How to combine custom paths with default sensitive paths.
115
+ * - 'merge': Custom paths are added to default paths (default)
116
+ * - 'override': Only custom paths are used, defaults are ignored
117
+ */
118
+ resolution?: 'merge' | 'override';
119
+ };
75
120
  type CreateLoggerOptions = {
121
+ /** Enable pretty printing with colors (disabled in production) */
76
122
  pretty?: boolean;
123
+ /** Minimum log level to output */
77
124
  level?: LogLevel;
125
+ /**
126
+ * Redaction configuration for masking sensitive data.
127
+ *
128
+ * - `true`: Uses default sensitive paths (password, token, secret, etc.)
129
+ * - `false` or `undefined`: No redaction applied
130
+ * - `string[]`: Custom paths merged with defaults
131
+ * - `object`: Advanced config with paths, censor, remove, and resolution options
132
+ *
133
+ * By default, custom paths are **merged** with the default sensitive paths.
134
+ * Use `resolution: 'override'` to disable defaults and use only your paths.
135
+ *
136
+ * @example
137
+ * ```typescript
138
+ * // Use defaults only
139
+ * createLogger({ redact: true });
140
+ *
141
+ * // Add custom paths (merged with defaults)
142
+ * createLogger({ redact: ['user.ssn', 'custom.field'] });
143
+ *
144
+ * // Override defaults completely
145
+ * createLogger({
146
+ * redact: {
147
+ * paths: ['only.these.paths'],
148
+ * resolution: 'override',
149
+ * }
150
+ * });
151
+ *
152
+ * // Merge with custom censor
153
+ * createLogger({
154
+ * redact: {
155
+ * paths: ['extra.secret'],
156
+ * censor: '***',
157
+ * }
158
+ * });
159
+ * ```
160
+ */
161
+ redact?: boolean | RedactOptions;
78
162
  };
79
163
  //#endregion
80
- export { CreateLoggerOptions, LogFn, LogLevel, Logger };
81
- //# sourceMappingURL=types-C1RfRbo6.d.mts.map
164
+ export { CreateLoggerOptions, LogFn, LogLevel, Logger, RedactOptions };
165
+ //# sourceMappingURL=types-Bga8WDuP.d.mts.map
@@ -72,10 +72,94 @@ declare enum LogLevel {
72
72
  Fatal = "fatal",
73
73
  Silent = "silent",
74
74
  }
75
+ /**
76
+ * Redaction configuration for masking sensitive data in logs.
77
+ * Uses pino's fast-redact library under the hood.
78
+ *
79
+ * By default, custom paths are merged with the default sensitive paths.
80
+ * Use `resolution: 'override'` to use only your custom paths.
81
+ *
82
+ * @example
83
+ * ```typescript
84
+ * // Simple path array (merges with defaults)
85
+ * redact: ['user.ssn', 'custom.field']
86
+ *
87
+ * // Override defaults completely
88
+ * redact: {
89
+ * paths: ['only.these.paths'],
90
+ * resolution: 'override',
91
+ * }
92
+ *
93
+ * // With custom censor
94
+ * redact: {
95
+ * paths: ['extra.secret'],
96
+ * censor: '***',
97
+ * }
98
+ *
99
+ * // Remove fields entirely
100
+ * redact: {
101
+ * paths: ['temporary.data'],
102
+ * remove: true,
103
+ * }
104
+ * ```
105
+ */
106
+ type RedactOptions = string[] | {
107
+ /** Paths to redact using dot notation or bracket notation for special chars */
108
+ paths: string[];
109
+ /** Custom replacement text (default: '[REDACTED]') */
110
+ censor?: string | ((value: unknown, path: string[]) => unknown);
111
+ /** Remove the field entirely instead of replacing (default: false) */
112
+ remove?: boolean;
113
+ /**
114
+ * How to combine custom paths with default sensitive paths.
115
+ * - 'merge': Custom paths are added to default paths (default)
116
+ * - 'override': Only custom paths are used, defaults are ignored
117
+ */
118
+ resolution?: 'merge' | 'override';
119
+ };
75
120
  type CreateLoggerOptions = {
121
+ /** Enable pretty printing with colors (disabled in production) */
76
122
  pretty?: boolean;
123
+ /** Minimum log level to output */
77
124
  level?: LogLevel;
125
+ /**
126
+ * Redaction configuration for masking sensitive data.
127
+ *
128
+ * - `true`: Uses default sensitive paths (password, token, secret, etc.)
129
+ * - `false` or `undefined`: No redaction applied
130
+ * - `string[]`: Custom paths merged with defaults
131
+ * - `object`: Advanced config with paths, censor, remove, and resolution options
132
+ *
133
+ * By default, custom paths are **merged** with the default sensitive paths.
134
+ * Use `resolution: 'override'` to disable defaults and use only your paths.
135
+ *
136
+ * @example
137
+ * ```typescript
138
+ * // Use defaults only
139
+ * createLogger({ redact: true });
140
+ *
141
+ * // Add custom paths (merged with defaults)
142
+ * createLogger({ redact: ['user.ssn', 'custom.field'] });
143
+ *
144
+ * // Override defaults completely
145
+ * createLogger({
146
+ * redact: {
147
+ * paths: ['only.these.paths'],
148
+ * resolution: 'override',
149
+ * }
150
+ * });
151
+ *
152
+ * // Merge with custom censor
153
+ * createLogger({
154
+ * redact: {
155
+ * paths: ['extra.secret'],
156
+ * censor: '***',
157
+ * }
158
+ * });
159
+ * ```
160
+ */
161
+ redact?: boolean | RedactOptions;
78
162
  };
79
163
  //#endregion
80
- export { CreateLoggerOptions, LogFn, LogLevel, Logger };
81
- //# sourceMappingURL=types-DXdmn7h5.d.cts.map
164
+ export { CreateLoggerOptions, LogFn, LogLevel, Logger, RedactOptions };
165
+ //# sourceMappingURL=types-JxCFymH0.d.cts.map