@geekmidas/logger 0.2.0 → 0.4.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/dist/console.cjs.map +1 -1
  2. package/dist/console.d.cts +2 -1
  3. package/dist/console.d.cts.map +1 -0
  4. package/dist/console.d.mts +2 -1
  5. package/dist/console.d.mts.map +1 -0
  6. package/dist/console.mjs.map +1 -1
  7. package/dist/index.d.cts +1 -1
  8. package/dist/index.d.mts +1 -1
  9. package/dist/pino.cjs.map +1 -1
  10. package/dist/pino.d.cts +3 -2
  11. package/dist/pino.d.cts.map +1 -0
  12. package/dist/pino.d.mts +3 -2
  13. package/dist/pino.d.mts.map +1 -0
  14. package/dist/pino.mjs.map +1 -1
  15. package/dist/{redact-paths-Br-tI2GZ.d.cts → redact-paths-CsK0_uz-.d.cts} +2 -1
  16. package/dist/redact-paths-CsK0_uz-.d.cts.map +1 -0
  17. package/dist/{redact-paths-CIsuxHH7.d.mts → redact-paths-D07eTMlH.d.mts} +2 -1
  18. package/dist/redact-paths-D07eTMlH.d.mts.map +1 -0
  19. package/dist/redact-paths-D0m0DIuQ.cjs.map +1 -1
  20. package/dist/redact-paths-DQoIXhkS.mjs.map +1 -1
  21. package/dist/redact-paths.d.cts +1 -1
  22. package/dist/redact-paths.d.mts +1 -1
  23. package/dist/{types-Bga8WDuP.d.mts → types-BDdpcrpy.d.mts} +2 -1
  24. package/dist/types-BDdpcrpy.d.mts.map +1 -0
  25. package/dist/{types-JxCFymH0.d.cts → types-Dk_k2-f_.d.cts} +2 -1
  26. package/dist/types-Dk_k2-f_.d.cts.map +1 -0
  27. package/dist/types-ag_0Cvbg.cjs.map +1 -1
  28. package/dist/types-yQ6XOihF.mjs.map +1 -1
  29. package/dist/types.d.cts +1 -1
  30. package/dist/types.d.mts +1 -1
  31. package/package.json +1 -1
  32. package/src/__tests__/console.spec.ts +648 -648
  33. package/src/__tests__/pino-redaction.integration.spec.ts +270 -270
  34. package/src/__tests__/pino.spec.ts +305 -305
  35. package/src/console.ts +100 -100
  36. package/src/index.ts +5 -5
  37. package/src/pino.ts +50 -50
  38. package/src/redact-paths.ts +52 -52
  39. package/src/types.ts +87 -87
  40. package/tsconfig.json +9 -0
@@ -1 +1 @@
1
- {"version":3,"file":"console.cjs","names":["LOG_LEVEL_PRIORITY: Record<LogLevel, number>","LogLevel","data: object","level: LogLevel","logMethod: (...args: any[]) => void","objOrMsg: T | string","msg?: string","logData","obj: object","options: CreateLoggerOptions"],"sources":["../src/console.ts"],"sourcesContent":["import type { CreateLoggerOptions, LogFn, Logger } from './types';\nimport { LogLevel } from './types';\n\n/**\n * Numeric priority for log levels (higher = more severe)\n */\nconst LOG_LEVEL_PRIORITY: Record<LogLevel, number> = {\n [LogLevel.Trace]: 10,\n [LogLevel.Debug]: 20,\n [LogLevel.Info]: 30,\n [LogLevel.Warn]: 40,\n [LogLevel.Error]: 50,\n [LogLevel.Fatal]: 60,\n [LogLevel.Silent]: 70,\n};\n\nexport class ConsoleLogger implements Logger {\n private readonly level: LogLevel;\n\n /**\n * Creates a new ConsoleLogger instance.\n *\n * @param data - Initial context data to include in all log messages\n * @param level - Minimum log level to output (default: Info)\n */\n constructor(\n readonly data: object = {},\n level: LogLevel = LogLevel.Info,\n ) {\n this.level = level;\n }\n\n /**\n * Checks if a log level should be output based on the configured minimum level.\n */\n private shouldLog(level: LogLevel): boolean {\n if (this.level === LogLevel.Silent) {\n return false;\n }\n return LOG_LEVEL_PRIORITY[level] >= LOG_LEVEL_PRIORITY[this.level];\n }\n\n /**\n * Creates a logging function that merges context data and adds timestamps.\n *\n * @param logMethod - The console method to use (e.g., console.log, console.error)\n * @param level - The log level for this method\n * @returns A LogFn that handles both structured and simple logging\n * @private\n */\n private createLogFn(\n logMethod: (...args: any[]) => void,\n level: LogLevel,\n ): LogFn {\n return <T extends object>(\n objOrMsg: T | string,\n msg?: string,\n ...args: any[]\n ): void => {\n if (!this.shouldLog(level)) {\n return;\n }\n\n const ts = Date.now();\n\n // Handle simple string logging: logger.info('message')\n if (typeof objOrMsg === 'string') {\n const logData = { ...this.data, msg: objOrMsg, ts };\n logMethod(logData, ...args);\n return;\n }\n\n // Handle structured logging: logger.info({ data }, 'message')\n const logData = msg\n ? { ...this.data, ...objOrMsg, msg, ts }\n : { ...this.data, ...objOrMsg, ts };\n logMethod(logData, ...args);\n };\n }\n\n /** Trace level logging function */\n trace: LogFn = this.createLogFn(console.trace.bind(console), LogLevel.Trace);\n /** Debug level logging function */\n debug: LogFn = this.createLogFn(console.debug.bind(console), LogLevel.Debug);\n /** Info level logging function */\n info: LogFn = this.createLogFn(console.info.bind(console), LogLevel.Info);\n /** Warning level logging function */\n warn: LogFn = this.createLogFn(console.warn.bind(console), LogLevel.Warn);\n /** Error level logging function */\n error: LogFn = this.createLogFn(console.error.bind(console), LogLevel.Error);\n /** Fatal level logging function (uses console.error) */\n fatal: LogFn = this.createLogFn(console.error.bind(console), LogLevel.Fatal);\n\n /**\n * Creates a child logger with additional context data.\n * The child logger inherits all context from the parent and adds its own.\n *\n * @param obj - Additional context data for the child logger\n * @returns A new ConsoleLogger instance with merged context\n *\n * @example\n * ```typescript\n * const parentLogger = new ConsoleLogger({ app: 'myApp' });\n * const childLogger = parentLogger.child({ module: 'database' });\n * childLogger.info({ query: 'SELECT * FROM users' }, 'Query executed');\n * // Context includes both { app: 'myApp' } and { module: 'database' }\n * ```\n */\n child(obj: object): Logger {\n return new ConsoleLogger(\n {\n ...this.data,\n ...obj,\n },\n this.level,\n );\n }\n}\n\n/**\n * @example Basic usage\n * ```typescript\n * const logger = new ConsoleLogger({ app: 'myApp' });\n * logger.info({ action: 'start' }, 'Application starting');\n * // Logs: { app: 'myApp', action: 'start', msg: 'Application starting', ts: 1234567890 }\n * ```\n *\n * @example Child logger usage\n * ```typescript\n * const childLogger = logger.child({ module: 'auth' });\n * childLogger.debug({ userId: 123 }, 'User authenticated');\n * // Logs: { app: 'myApp', module: 'auth', userId: 123, msg: 'User authenticated', ts: 1234567891 }\n * ```\n *\n * @example Error logging with context\n * ```typescript\n * try {\n * await someOperation();\n * } catch (error) {\n * logger.error({ error, operation: 'someOperation' }, 'Operation failed');\n * }\n * ```\n */\n\nexport const DEFAULT_LOGGER = new ConsoleLogger() as any;\n\n/**\n * Creates a console logger with the same API as pino's createLogger.\n *\n * @param options - Logger configuration options\n * @returns A ConsoleLogger instance\n *\n * @example\n * ```typescript\n * import { createLogger } from '@geekmidas/logger/console';\n * import { LogLevel } from '@geekmidas/logger';\n *\n * const logger = createLogger({ level: LogLevel.Debug });\n * logger.debug('This will be logged');\n * logger.trace('This will NOT be logged (below Debug level)');\n * ```\n */\nexport function createLogger(options: CreateLoggerOptions = {}): Logger {\n return new ConsoleLogger({}, options.level ?? LogLevel.Info);\n}\n"],"mappings":";;;;;;AAMA,MAAMA,qBAA+C;EAClDC,uBAAS,QAAQ;EACjBA,uBAAS,QAAQ;EACjBA,uBAAS,OAAO;EAChBA,uBAAS,OAAO;EAChBA,uBAAS,QAAQ;EACjBA,uBAAS,QAAQ;EACjBA,uBAAS,SAAS;AACpB;AAED,IAAa,gBAAb,MAAa,cAAgC;CAC3C,AAAiB;;;;;;;CAQjB,YACWC,OAAe,CAAE,GAC1BC,QAAkBF,uBAAS,MAC3B;EAFS;AAGT,OAAK,QAAQ;CACd;;;;CAKD,AAAQ,UAAUE,OAA0B;AAC1C,MAAI,KAAK,UAAUF,uBAAS,OAC1B,QAAO;AAET,SAAO,mBAAmB,UAAU,mBAAmB,KAAK;CAC7D;;;;;;;;;CAUD,AAAQ,YACNG,WACAD,OACO;AACP,SAAO,CACLE,UACAC,KACA,GAAG,SACM;AACT,QAAK,KAAK,UAAU,MAAM,CACxB;GAGF,MAAM,KAAK,KAAK,KAAK;AAGrB,cAAW,aAAa,UAAU;IAChC,MAAMC,YAAU;KAAE,GAAG,KAAK;KAAM,KAAK;KAAU;IAAI;AACnD,cAAUA,WAAS,GAAG,KAAK;AAC3B;GACD;GAGD,MAAM,UAAU,MACZ;IAAE,GAAG,KAAK;IAAM,GAAG;IAAU;IAAK;GAAI,IACtC;IAAE,GAAG,KAAK;IAAM,GAAG;IAAU;GAAI;AACrC,aAAU,SAAS,GAAG,KAAK;EAC5B;CACF;;CAGD,QAAe,KAAK,YAAY,QAAQ,MAAM,KAAK,QAAQ,EAAEN,uBAAS,MAAM;;CAE5E,QAAe,KAAK,YAAY,QAAQ,MAAM,KAAK,QAAQ,EAAEA,uBAAS,MAAM;;CAE5E,OAAc,KAAK,YAAY,QAAQ,KAAK,KAAK,QAAQ,EAAEA,uBAAS,KAAK;;CAEzE,OAAc,KAAK,YAAY,QAAQ,KAAK,KAAK,QAAQ,EAAEA,uBAAS,KAAK;;CAEzE,QAAe,KAAK,YAAY,QAAQ,MAAM,KAAK,QAAQ,EAAEA,uBAAS,MAAM;;CAE5E,QAAe,KAAK,YAAY,QAAQ,MAAM,KAAK,QAAQ,EAAEA,uBAAS,MAAM;;;;;;;;;;;;;;;;CAiB5E,MAAMO,KAAqB;AACzB,SAAO,IAAI,cACT;GACE,GAAG,KAAK;GACR,GAAG;EACJ,GACD,KAAK;CAER;AACF;;;;;;;;;;;;;;;;;;;;;;;;;AA2BD,MAAa,iBAAiB,IAAI;;;;;;;;;;;;;;;;;AAkBlC,SAAgB,aAAaC,UAA+B,CAAE,GAAU;AACtE,QAAO,IAAI,cAAc,CAAE,GAAE,QAAQ,SAASR,uBAAS;AACxD"}
1
+ {"version":3,"file":"console.cjs","names":["LOG_LEVEL_PRIORITY: Record<LogLevel, number>","LogLevel","data: object","level: LogLevel","logMethod: (...args: any[]) => void","objOrMsg: T | string","msg?: string","logData","obj: object","options: CreateLoggerOptions"],"sources":["../src/console.ts"],"sourcesContent":["import type { CreateLoggerOptions, LogFn, Logger } from './types';\nimport { LogLevel } from './types';\n\n/**\n * Numeric priority for log levels (higher = more severe)\n */\nconst LOG_LEVEL_PRIORITY: Record<LogLevel, number> = {\n\t[LogLevel.Trace]: 10,\n\t[LogLevel.Debug]: 20,\n\t[LogLevel.Info]: 30,\n\t[LogLevel.Warn]: 40,\n\t[LogLevel.Error]: 50,\n\t[LogLevel.Fatal]: 60,\n\t[LogLevel.Silent]: 70,\n};\n\nexport class ConsoleLogger implements Logger {\n\tprivate readonly level: LogLevel;\n\n\t/**\n\t * Creates a new ConsoleLogger instance.\n\t *\n\t * @param data - Initial context data to include in all log messages\n\t * @param level - Minimum log level to output (default: Info)\n\t */\n\tconstructor(\n\t\treadonly data: object = {},\n\t\tlevel: LogLevel = LogLevel.Info,\n\t) {\n\t\tthis.level = level;\n\t}\n\n\t/**\n\t * Checks if a log level should be output based on the configured minimum level.\n\t */\n\tprivate shouldLog(level: LogLevel): boolean {\n\t\tif (this.level === LogLevel.Silent) {\n\t\t\treturn false;\n\t\t}\n\t\treturn LOG_LEVEL_PRIORITY[level] >= LOG_LEVEL_PRIORITY[this.level];\n\t}\n\n\t/**\n\t * Creates a logging function that merges context data and adds timestamps.\n\t *\n\t * @param logMethod - The console method to use (e.g., console.log, console.error)\n\t * @param level - The log level for this method\n\t * @returns A LogFn that handles both structured and simple logging\n\t * @private\n\t */\n\tprivate createLogFn(\n\t\tlogMethod: (...args: any[]) => void,\n\t\tlevel: LogLevel,\n\t): LogFn {\n\t\treturn <T extends object>(\n\t\t\tobjOrMsg: T | string,\n\t\t\tmsg?: string,\n\t\t\t...args: any[]\n\t\t): void => {\n\t\t\tif (!this.shouldLog(level)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst ts = Date.now();\n\n\t\t\t// Handle simple string logging: logger.info('message')\n\t\t\tif (typeof objOrMsg === 'string') {\n\t\t\t\tconst logData = { ...this.data, msg: objOrMsg, ts };\n\t\t\t\tlogMethod(logData, ...args);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Handle structured logging: logger.info({ data }, 'message')\n\t\t\tconst logData = msg\n\t\t\t\t? { ...this.data, ...objOrMsg, msg, ts }\n\t\t\t\t: { ...this.data, ...objOrMsg, ts };\n\t\t\tlogMethod(logData, ...args);\n\t\t};\n\t}\n\n\t/** Trace level logging function */\n\ttrace: LogFn = this.createLogFn(console.trace.bind(console), LogLevel.Trace);\n\t/** Debug level logging function */\n\tdebug: LogFn = this.createLogFn(console.debug.bind(console), LogLevel.Debug);\n\t/** Info level logging function */\n\tinfo: LogFn = this.createLogFn(console.info.bind(console), LogLevel.Info);\n\t/** Warning level logging function */\n\twarn: LogFn = this.createLogFn(console.warn.bind(console), LogLevel.Warn);\n\t/** Error level logging function */\n\terror: LogFn = this.createLogFn(console.error.bind(console), LogLevel.Error);\n\t/** Fatal level logging function (uses console.error) */\n\tfatal: LogFn = this.createLogFn(console.error.bind(console), LogLevel.Fatal);\n\n\t/**\n\t * Creates a child logger with additional context data.\n\t * The child logger inherits all context from the parent and adds its own.\n\t *\n\t * @param obj - Additional context data for the child logger\n\t * @returns A new ConsoleLogger instance with merged context\n\t *\n\t * @example\n\t * ```typescript\n\t * const parentLogger = new ConsoleLogger({ app: 'myApp' });\n\t * const childLogger = parentLogger.child({ module: 'database' });\n\t * childLogger.info({ query: 'SELECT * FROM users' }, 'Query executed');\n\t * // Context includes both { app: 'myApp' } and { module: 'database' }\n\t * ```\n\t */\n\tchild(obj: object): Logger {\n\t\treturn new ConsoleLogger(\n\t\t\t{\n\t\t\t\t...this.data,\n\t\t\t\t...obj,\n\t\t\t},\n\t\t\tthis.level,\n\t\t);\n\t}\n}\n\n/**\n * @example Basic usage\n * ```typescript\n * const logger = new ConsoleLogger({ app: 'myApp' });\n * logger.info({ action: 'start' }, 'Application starting');\n * // Logs: { app: 'myApp', action: 'start', msg: 'Application starting', ts: 1234567890 }\n * ```\n *\n * @example Child logger usage\n * ```typescript\n * const childLogger = logger.child({ module: 'auth' });\n * childLogger.debug({ userId: 123 }, 'User authenticated');\n * // Logs: { app: 'myApp', module: 'auth', userId: 123, msg: 'User authenticated', ts: 1234567891 }\n * ```\n *\n * @example Error logging with context\n * ```typescript\n * try {\n * await someOperation();\n * } catch (error) {\n * logger.error({ error, operation: 'someOperation' }, 'Operation failed');\n * }\n * ```\n */\n\nexport const DEFAULT_LOGGER = new ConsoleLogger() as any;\n\n/**\n * Creates a console logger with the same API as pino's createLogger.\n *\n * @param options - Logger configuration options\n * @returns A ConsoleLogger instance\n *\n * @example\n * ```typescript\n * import { createLogger } from '@geekmidas/logger/console';\n * import { LogLevel } from '@geekmidas/logger';\n *\n * const logger = createLogger({ level: LogLevel.Debug });\n * logger.debug('This will be logged');\n * logger.trace('This will NOT be logged (below Debug level)');\n * ```\n */\nexport function createLogger(options: CreateLoggerOptions = {}): Logger {\n\treturn new ConsoleLogger({}, options.level ?? LogLevel.Info);\n}\n"],"mappings":";;;;;;AAMA,MAAMA,qBAA+C;EACnDC,uBAAS,QAAQ;EACjBA,uBAAS,QAAQ;EACjBA,uBAAS,OAAO;EAChBA,uBAAS,OAAO;EAChBA,uBAAS,QAAQ;EACjBA,uBAAS,QAAQ;EACjBA,uBAAS,SAAS;AACnB;AAED,IAAa,gBAAb,MAAa,cAAgC;CAC5C,AAAiB;;;;;;;CAQjB,YACUC,OAAe,CAAE,GAC1BC,QAAkBF,uBAAS,MAC1B;EAFQ;AAGT,OAAK,QAAQ;CACb;;;;CAKD,AAAQ,UAAUE,OAA0B;AAC3C,MAAI,KAAK,UAAUF,uBAAS,OAC3B,QAAO;AAER,SAAO,mBAAmB,UAAU,mBAAmB,KAAK;CAC5D;;;;;;;;;CAUD,AAAQ,YACPG,WACAD,OACQ;AACR,SAAO,CACNE,UACAC,KACA,GAAG,SACO;AACV,QAAK,KAAK,UAAU,MAAM,CACzB;GAGD,MAAM,KAAK,KAAK,KAAK;AAGrB,cAAW,aAAa,UAAU;IACjC,MAAMC,YAAU;KAAE,GAAG,KAAK;KAAM,KAAK;KAAU;IAAI;AACnD,cAAUA,WAAS,GAAG,KAAK;AAC3B;GACA;GAGD,MAAM,UAAU,MACb;IAAE,GAAG,KAAK;IAAM,GAAG;IAAU;IAAK;GAAI,IACtC;IAAE,GAAG,KAAK;IAAM,GAAG;IAAU;GAAI;AACpC,aAAU,SAAS,GAAG,KAAK;EAC3B;CACD;;CAGD,QAAe,KAAK,YAAY,QAAQ,MAAM,KAAK,QAAQ,EAAEN,uBAAS,MAAM;;CAE5E,QAAe,KAAK,YAAY,QAAQ,MAAM,KAAK,QAAQ,EAAEA,uBAAS,MAAM;;CAE5E,OAAc,KAAK,YAAY,QAAQ,KAAK,KAAK,QAAQ,EAAEA,uBAAS,KAAK;;CAEzE,OAAc,KAAK,YAAY,QAAQ,KAAK,KAAK,QAAQ,EAAEA,uBAAS,KAAK;;CAEzE,QAAe,KAAK,YAAY,QAAQ,MAAM,KAAK,QAAQ,EAAEA,uBAAS,MAAM;;CAE5E,QAAe,KAAK,YAAY,QAAQ,MAAM,KAAK,QAAQ,EAAEA,uBAAS,MAAM;;;;;;;;;;;;;;;;CAiB5E,MAAMO,KAAqB;AAC1B,SAAO,IAAI,cACV;GACC,GAAG,KAAK;GACR,GAAG;EACH,GACD,KAAK;CAEN;AACD;;;;;;;;;;;;;;;;;;;;;;;;;AA2BD,MAAa,iBAAiB,IAAI;;;;;;;;;;;;;;;;;AAkBlC,SAAgB,aAAaC,UAA+B,CAAE,GAAU;AACvE,QAAO,IAAI,cAAc,CAAE,GAAE,QAAQ,SAASR,uBAAS;AACvD"}
@@ -1,4 +1,4 @@
1
- import { CreateLoggerOptions, LogFn, LogLevel, Logger } from "./types-JxCFymH0.cjs";
1
+ import { CreateLoggerOptions, LogFn, LogLevel, Logger } from "./types-Dk_k2-f_.cjs";
2
2
 
3
3
  //#region src/console.d.ts
4
4
  declare class ConsoleLogger implements Logger {
@@ -95,6 +95,7 @@ declare const DEFAULT_LOGGER: any;
95
95
  * ```
96
96
  */
97
97
  declare function createLogger(options?: CreateLoggerOptions): Logger;
98
+ //# sourceMappingURL=console.d.ts.map
98
99
  //#endregion
99
100
  export { ConsoleLogger, DEFAULT_LOGGER, createLogger };
100
101
  //# sourceMappingURL=console.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console.d.cts","names":[],"sources":["../src/console.ts"],"sourcesContent":[],"mappings":";;;cAgBa,aAAA,YAAyB;EAAzB,SAAA,IAAA,EAAA,MAAc;EAAA,iBAAA,KAAA;EAAA;;;;;;EAyEd,WAEL,CAAA,IAAA,CAAA,EAAA,MAAA,EAAA,KAAA,CAAA,EAhEC,QAgED;EAAK;;AA3E+B;EAgI/B,QAAA,SAA2C;EAkBxC;;;;AAAuD;;;;;;SAjF/D;;SAEA;;QAED;;QAEA;;SAEC;;SAEA;;;;;;;;;;;;;;;;sBAiBa;;;;;;;;;;;;;;;;;;;;;;;;;;cAoCR;;;;;;;;;;;;;;;;;iBAkBG,YAAA,WAAsB,sBAA2B"}
@@ -1,4 +1,4 @@
1
- import { CreateLoggerOptions, LogFn, LogLevel, Logger } from "./types-Bga8WDuP.mjs";
1
+ import { CreateLoggerOptions, LogFn, LogLevel, Logger } from "./types-BDdpcrpy.mjs";
2
2
 
3
3
  //#region src/console.d.ts
4
4
  declare class ConsoleLogger implements Logger {
@@ -95,6 +95,7 @@ declare const DEFAULT_LOGGER: any;
95
95
  * ```
96
96
  */
97
97
  declare function createLogger(options?: CreateLoggerOptions): Logger;
98
+ //# sourceMappingURL=console.d.ts.map
98
99
  //#endregion
99
100
  export { ConsoleLogger, DEFAULT_LOGGER, createLogger };
100
101
  //# sourceMappingURL=console.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console.d.mts","names":[],"sources":["../src/console.ts"],"sourcesContent":[],"mappings":";;;cAgBa,aAAA,YAAyB;EAAzB,SAAA,IAAA,EAAA,MAAc;EAAA,iBAAA,KAAA;EAAA;;;;;;EAyEd,WAEL,CAAA,IAAA,CAAA,EAAA,MAAA,EAAA,KAAA,CAAA,EAhEC,QAgED;EAAK;;AA3E+B;EAgI/B,QAAA,SAA2C;EAkBxC;;;;AAAuD;;;;;;SAjF/D;;SAEA;;QAED;;QAEA;;SAEC;;SAEA;;;;;;;;;;;;;;;;sBAiBa;;;;;;;;;;;;;;;;;;;;;;;;;;cAoCR;;;;;;;;;;;;;;;;;iBAkBG,YAAA,WAAsB,sBAA2B"}
@@ -1 +1 @@
1
- {"version":3,"file":"console.mjs","names":["LOG_LEVEL_PRIORITY: Record<LogLevel, number>","data: object","level: LogLevel","logMethod: (...args: any[]) => void","objOrMsg: T | string","msg?: string","logData","obj: object","options: CreateLoggerOptions"],"sources":["../src/console.ts"],"sourcesContent":["import type { CreateLoggerOptions, LogFn, Logger } from './types';\nimport { LogLevel } from './types';\n\n/**\n * Numeric priority for log levels (higher = more severe)\n */\nconst LOG_LEVEL_PRIORITY: Record<LogLevel, number> = {\n [LogLevel.Trace]: 10,\n [LogLevel.Debug]: 20,\n [LogLevel.Info]: 30,\n [LogLevel.Warn]: 40,\n [LogLevel.Error]: 50,\n [LogLevel.Fatal]: 60,\n [LogLevel.Silent]: 70,\n};\n\nexport class ConsoleLogger implements Logger {\n private readonly level: LogLevel;\n\n /**\n * Creates a new ConsoleLogger instance.\n *\n * @param data - Initial context data to include in all log messages\n * @param level - Minimum log level to output (default: Info)\n */\n constructor(\n readonly data: object = {},\n level: LogLevel = LogLevel.Info,\n ) {\n this.level = level;\n }\n\n /**\n * Checks if a log level should be output based on the configured minimum level.\n */\n private shouldLog(level: LogLevel): boolean {\n if (this.level === LogLevel.Silent) {\n return false;\n }\n return LOG_LEVEL_PRIORITY[level] >= LOG_LEVEL_PRIORITY[this.level];\n }\n\n /**\n * Creates a logging function that merges context data and adds timestamps.\n *\n * @param logMethod - The console method to use (e.g., console.log, console.error)\n * @param level - The log level for this method\n * @returns A LogFn that handles both structured and simple logging\n * @private\n */\n private createLogFn(\n logMethod: (...args: any[]) => void,\n level: LogLevel,\n ): LogFn {\n return <T extends object>(\n objOrMsg: T | string,\n msg?: string,\n ...args: any[]\n ): void => {\n if (!this.shouldLog(level)) {\n return;\n }\n\n const ts = Date.now();\n\n // Handle simple string logging: logger.info('message')\n if (typeof objOrMsg === 'string') {\n const logData = { ...this.data, msg: objOrMsg, ts };\n logMethod(logData, ...args);\n return;\n }\n\n // Handle structured logging: logger.info({ data }, 'message')\n const logData = msg\n ? { ...this.data, ...objOrMsg, msg, ts }\n : { ...this.data, ...objOrMsg, ts };\n logMethod(logData, ...args);\n };\n }\n\n /** Trace level logging function */\n trace: LogFn = this.createLogFn(console.trace.bind(console), LogLevel.Trace);\n /** Debug level logging function */\n debug: LogFn = this.createLogFn(console.debug.bind(console), LogLevel.Debug);\n /** Info level logging function */\n info: LogFn = this.createLogFn(console.info.bind(console), LogLevel.Info);\n /** Warning level logging function */\n warn: LogFn = this.createLogFn(console.warn.bind(console), LogLevel.Warn);\n /** Error level logging function */\n error: LogFn = this.createLogFn(console.error.bind(console), LogLevel.Error);\n /** Fatal level logging function (uses console.error) */\n fatal: LogFn = this.createLogFn(console.error.bind(console), LogLevel.Fatal);\n\n /**\n * Creates a child logger with additional context data.\n * The child logger inherits all context from the parent and adds its own.\n *\n * @param obj - Additional context data for the child logger\n * @returns A new ConsoleLogger instance with merged context\n *\n * @example\n * ```typescript\n * const parentLogger = new ConsoleLogger({ app: 'myApp' });\n * const childLogger = parentLogger.child({ module: 'database' });\n * childLogger.info({ query: 'SELECT * FROM users' }, 'Query executed');\n * // Context includes both { app: 'myApp' } and { module: 'database' }\n * ```\n */\n child(obj: object): Logger {\n return new ConsoleLogger(\n {\n ...this.data,\n ...obj,\n },\n this.level,\n );\n }\n}\n\n/**\n * @example Basic usage\n * ```typescript\n * const logger = new ConsoleLogger({ app: 'myApp' });\n * logger.info({ action: 'start' }, 'Application starting');\n * // Logs: { app: 'myApp', action: 'start', msg: 'Application starting', ts: 1234567890 }\n * ```\n *\n * @example Child logger usage\n * ```typescript\n * const childLogger = logger.child({ module: 'auth' });\n * childLogger.debug({ userId: 123 }, 'User authenticated');\n * // Logs: { app: 'myApp', module: 'auth', userId: 123, msg: 'User authenticated', ts: 1234567891 }\n * ```\n *\n * @example Error logging with context\n * ```typescript\n * try {\n * await someOperation();\n * } catch (error) {\n * logger.error({ error, operation: 'someOperation' }, 'Operation failed');\n * }\n * ```\n */\n\nexport const DEFAULT_LOGGER = new ConsoleLogger() as any;\n\n/**\n * Creates a console logger with the same API as pino's createLogger.\n *\n * @param options - Logger configuration options\n * @returns A ConsoleLogger instance\n *\n * @example\n * ```typescript\n * import { createLogger } from '@geekmidas/logger/console';\n * import { LogLevel } from '@geekmidas/logger';\n *\n * const logger = createLogger({ level: LogLevel.Debug });\n * logger.debug('This will be logged');\n * logger.trace('This will NOT be logged (below Debug level)');\n * ```\n */\nexport function createLogger(options: CreateLoggerOptions = {}): Logger {\n return new ConsoleLogger({}, options.level ?? LogLevel.Info);\n}\n"],"mappings":";;;;;;AAMA,MAAMA,qBAA+C;EAClD,SAAS,QAAQ;EACjB,SAAS,QAAQ;EACjB,SAAS,OAAO;EAChB,SAAS,OAAO;EAChB,SAAS,QAAQ;EACjB,SAAS,QAAQ;EACjB,SAAS,SAAS;AACpB;AAED,IAAa,gBAAb,MAAa,cAAgC;CAC3C,AAAiB;;;;;;;CAQjB,YACWC,OAAe,CAAE,GAC1BC,QAAkB,SAAS,MAC3B;EAFS;AAGT,OAAK,QAAQ;CACd;;;;CAKD,AAAQ,UAAUA,OAA0B;AAC1C,MAAI,KAAK,UAAU,SAAS,OAC1B,QAAO;AAET,SAAO,mBAAmB,UAAU,mBAAmB,KAAK;CAC7D;;;;;;;;;CAUD,AAAQ,YACNC,WACAD,OACO;AACP,SAAO,CACLE,UACAC,KACA,GAAG,SACM;AACT,QAAK,KAAK,UAAU,MAAM,CACxB;GAGF,MAAM,KAAK,KAAK,KAAK;AAGrB,cAAW,aAAa,UAAU;IAChC,MAAMC,YAAU;KAAE,GAAG,KAAK;KAAM,KAAK;KAAU;IAAI;AACnD,cAAUA,WAAS,GAAG,KAAK;AAC3B;GACD;GAGD,MAAM,UAAU,MACZ;IAAE,GAAG,KAAK;IAAM,GAAG;IAAU;IAAK;GAAI,IACtC;IAAE,GAAG,KAAK;IAAM,GAAG;IAAU;GAAI;AACrC,aAAU,SAAS,GAAG,KAAK;EAC5B;CACF;;CAGD,QAAe,KAAK,YAAY,QAAQ,MAAM,KAAK,QAAQ,EAAE,SAAS,MAAM;;CAE5E,QAAe,KAAK,YAAY,QAAQ,MAAM,KAAK,QAAQ,EAAE,SAAS,MAAM;;CAE5E,OAAc,KAAK,YAAY,QAAQ,KAAK,KAAK,QAAQ,EAAE,SAAS,KAAK;;CAEzE,OAAc,KAAK,YAAY,QAAQ,KAAK,KAAK,QAAQ,EAAE,SAAS,KAAK;;CAEzE,QAAe,KAAK,YAAY,QAAQ,MAAM,KAAK,QAAQ,EAAE,SAAS,MAAM;;CAE5E,QAAe,KAAK,YAAY,QAAQ,MAAM,KAAK,QAAQ,EAAE,SAAS,MAAM;;;;;;;;;;;;;;;;CAiB5E,MAAMC,KAAqB;AACzB,SAAO,IAAI,cACT;GACE,GAAG,KAAK;GACR,GAAG;EACJ,GACD,KAAK;CAER;AACF;;;;;;;;;;;;;;;;;;;;;;;;;AA2BD,MAAa,iBAAiB,IAAI;;;;;;;;;;;;;;;;;AAkBlC,SAAgB,aAAaC,UAA+B,CAAE,GAAU;AACtE,QAAO,IAAI,cAAc,CAAE,GAAE,QAAQ,SAAS,SAAS;AACxD"}
1
+ {"version":3,"file":"console.mjs","names":["LOG_LEVEL_PRIORITY: Record<LogLevel, number>","data: object","level: LogLevel","logMethod: (...args: any[]) => void","objOrMsg: T | string","msg?: string","logData","obj: object","options: CreateLoggerOptions"],"sources":["../src/console.ts"],"sourcesContent":["import type { CreateLoggerOptions, LogFn, Logger } from './types';\nimport { LogLevel } from './types';\n\n/**\n * Numeric priority for log levels (higher = more severe)\n */\nconst LOG_LEVEL_PRIORITY: Record<LogLevel, number> = {\n\t[LogLevel.Trace]: 10,\n\t[LogLevel.Debug]: 20,\n\t[LogLevel.Info]: 30,\n\t[LogLevel.Warn]: 40,\n\t[LogLevel.Error]: 50,\n\t[LogLevel.Fatal]: 60,\n\t[LogLevel.Silent]: 70,\n};\n\nexport class ConsoleLogger implements Logger {\n\tprivate readonly level: LogLevel;\n\n\t/**\n\t * Creates a new ConsoleLogger instance.\n\t *\n\t * @param data - Initial context data to include in all log messages\n\t * @param level - Minimum log level to output (default: Info)\n\t */\n\tconstructor(\n\t\treadonly data: object = {},\n\t\tlevel: LogLevel = LogLevel.Info,\n\t) {\n\t\tthis.level = level;\n\t}\n\n\t/**\n\t * Checks if a log level should be output based on the configured minimum level.\n\t */\n\tprivate shouldLog(level: LogLevel): boolean {\n\t\tif (this.level === LogLevel.Silent) {\n\t\t\treturn false;\n\t\t}\n\t\treturn LOG_LEVEL_PRIORITY[level] >= LOG_LEVEL_PRIORITY[this.level];\n\t}\n\n\t/**\n\t * Creates a logging function that merges context data and adds timestamps.\n\t *\n\t * @param logMethod - The console method to use (e.g., console.log, console.error)\n\t * @param level - The log level for this method\n\t * @returns A LogFn that handles both structured and simple logging\n\t * @private\n\t */\n\tprivate createLogFn(\n\t\tlogMethod: (...args: any[]) => void,\n\t\tlevel: LogLevel,\n\t): LogFn {\n\t\treturn <T extends object>(\n\t\t\tobjOrMsg: T | string,\n\t\t\tmsg?: string,\n\t\t\t...args: any[]\n\t\t): void => {\n\t\t\tif (!this.shouldLog(level)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst ts = Date.now();\n\n\t\t\t// Handle simple string logging: logger.info('message')\n\t\t\tif (typeof objOrMsg === 'string') {\n\t\t\t\tconst logData = { ...this.data, msg: objOrMsg, ts };\n\t\t\t\tlogMethod(logData, ...args);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Handle structured logging: logger.info({ data }, 'message')\n\t\t\tconst logData = msg\n\t\t\t\t? { ...this.data, ...objOrMsg, msg, ts }\n\t\t\t\t: { ...this.data, ...objOrMsg, ts };\n\t\t\tlogMethod(logData, ...args);\n\t\t};\n\t}\n\n\t/** Trace level logging function */\n\ttrace: LogFn = this.createLogFn(console.trace.bind(console), LogLevel.Trace);\n\t/** Debug level logging function */\n\tdebug: LogFn = this.createLogFn(console.debug.bind(console), LogLevel.Debug);\n\t/** Info level logging function */\n\tinfo: LogFn = this.createLogFn(console.info.bind(console), LogLevel.Info);\n\t/** Warning level logging function */\n\twarn: LogFn = this.createLogFn(console.warn.bind(console), LogLevel.Warn);\n\t/** Error level logging function */\n\terror: LogFn = this.createLogFn(console.error.bind(console), LogLevel.Error);\n\t/** Fatal level logging function (uses console.error) */\n\tfatal: LogFn = this.createLogFn(console.error.bind(console), LogLevel.Fatal);\n\n\t/**\n\t * Creates a child logger with additional context data.\n\t * The child logger inherits all context from the parent and adds its own.\n\t *\n\t * @param obj - Additional context data for the child logger\n\t * @returns A new ConsoleLogger instance with merged context\n\t *\n\t * @example\n\t * ```typescript\n\t * const parentLogger = new ConsoleLogger({ app: 'myApp' });\n\t * const childLogger = parentLogger.child({ module: 'database' });\n\t * childLogger.info({ query: 'SELECT * FROM users' }, 'Query executed');\n\t * // Context includes both { app: 'myApp' } and { module: 'database' }\n\t * ```\n\t */\n\tchild(obj: object): Logger {\n\t\treturn new ConsoleLogger(\n\t\t\t{\n\t\t\t\t...this.data,\n\t\t\t\t...obj,\n\t\t\t},\n\t\t\tthis.level,\n\t\t);\n\t}\n}\n\n/**\n * @example Basic usage\n * ```typescript\n * const logger = new ConsoleLogger({ app: 'myApp' });\n * logger.info({ action: 'start' }, 'Application starting');\n * // Logs: { app: 'myApp', action: 'start', msg: 'Application starting', ts: 1234567890 }\n * ```\n *\n * @example Child logger usage\n * ```typescript\n * const childLogger = logger.child({ module: 'auth' });\n * childLogger.debug({ userId: 123 }, 'User authenticated');\n * // Logs: { app: 'myApp', module: 'auth', userId: 123, msg: 'User authenticated', ts: 1234567891 }\n * ```\n *\n * @example Error logging with context\n * ```typescript\n * try {\n * await someOperation();\n * } catch (error) {\n * logger.error({ error, operation: 'someOperation' }, 'Operation failed');\n * }\n * ```\n */\n\nexport const DEFAULT_LOGGER = new ConsoleLogger() as any;\n\n/**\n * Creates a console logger with the same API as pino's createLogger.\n *\n * @param options - Logger configuration options\n * @returns A ConsoleLogger instance\n *\n * @example\n * ```typescript\n * import { createLogger } from '@geekmidas/logger/console';\n * import { LogLevel } from '@geekmidas/logger';\n *\n * const logger = createLogger({ level: LogLevel.Debug });\n * logger.debug('This will be logged');\n * logger.trace('This will NOT be logged (below Debug level)');\n * ```\n */\nexport function createLogger(options: CreateLoggerOptions = {}): Logger {\n\treturn new ConsoleLogger({}, options.level ?? LogLevel.Info);\n}\n"],"mappings":";;;;;;AAMA,MAAMA,qBAA+C;EACnD,SAAS,QAAQ;EACjB,SAAS,QAAQ;EACjB,SAAS,OAAO;EAChB,SAAS,OAAO;EAChB,SAAS,QAAQ;EACjB,SAAS,QAAQ;EACjB,SAAS,SAAS;AACnB;AAED,IAAa,gBAAb,MAAa,cAAgC;CAC5C,AAAiB;;;;;;;CAQjB,YACUC,OAAe,CAAE,GAC1BC,QAAkB,SAAS,MAC1B;EAFQ;AAGT,OAAK,QAAQ;CACb;;;;CAKD,AAAQ,UAAUA,OAA0B;AAC3C,MAAI,KAAK,UAAU,SAAS,OAC3B,QAAO;AAER,SAAO,mBAAmB,UAAU,mBAAmB,KAAK;CAC5D;;;;;;;;;CAUD,AAAQ,YACPC,WACAD,OACQ;AACR,SAAO,CACNE,UACAC,KACA,GAAG,SACO;AACV,QAAK,KAAK,UAAU,MAAM,CACzB;GAGD,MAAM,KAAK,KAAK,KAAK;AAGrB,cAAW,aAAa,UAAU;IACjC,MAAMC,YAAU;KAAE,GAAG,KAAK;KAAM,KAAK;KAAU;IAAI;AACnD,cAAUA,WAAS,GAAG,KAAK;AAC3B;GACA;GAGD,MAAM,UAAU,MACb;IAAE,GAAG,KAAK;IAAM,GAAG;IAAU;IAAK;GAAI,IACtC;IAAE,GAAG,KAAK;IAAM,GAAG;IAAU;GAAI;AACpC,aAAU,SAAS,GAAG,KAAK;EAC3B;CACD;;CAGD,QAAe,KAAK,YAAY,QAAQ,MAAM,KAAK,QAAQ,EAAE,SAAS,MAAM;;CAE5E,QAAe,KAAK,YAAY,QAAQ,MAAM,KAAK,QAAQ,EAAE,SAAS,MAAM;;CAE5E,OAAc,KAAK,YAAY,QAAQ,KAAK,KAAK,QAAQ,EAAE,SAAS,KAAK;;CAEzE,OAAc,KAAK,YAAY,QAAQ,KAAK,KAAK,QAAQ,EAAE,SAAS,KAAK;;CAEzE,QAAe,KAAK,YAAY,QAAQ,MAAM,KAAK,QAAQ,EAAE,SAAS,MAAM;;CAE5E,QAAe,KAAK,YAAY,QAAQ,MAAM,KAAK,QAAQ,EAAE,SAAS,MAAM;;;;;;;;;;;;;;;;CAiB5E,MAAMC,KAAqB;AAC1B,SAAO,IAAI,cACV;GACC,GAAG,KAAK;GACR,GAAG;EACH,GACD,KAAK;CAEN;AACD;;;;;;;;;;;;;;;;;;;;;;;;;AA2BD,MAAa,iBAAiB,IAAI;;;;;;;;;;;;;;;;;AAkBlC,SAAgB,aAAaC,UAA+B,CAAE,GAAU;AACvE,QAAO,IAAI,cAAc,CAAE,GAAE,QAAQ,SAAS,SAAS;AACvD"}
package/dist/index.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { CreateLoggerOptions, LogFn, LogLevel, Logger, RedactOptions } from "./types-JxCFymH0.cjs";
1
+ import { CreateLoggerOptions, LogFn, LogLevel, Logger, RedactOptions } from "./types-Dk_k2-f_.cjs";
2
2
  export { CreateLoggerOptions, LogFn, LogLevel, Logger, RedactOptions };
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { CreateLoggerOptions, LogFn, LogLevel, Logger, RedactOptions } from "./types-Bga8WDuP.mjs";
1
+ import { CreateLoggerOptions, LogFn, LogLevel, Logger, RedactOptions } from "./types-BDdpcrpy.mjs";
2
2
  export { CreateLoggerOptions, LogFn, LogLevel, Logger, RedactOptions };
package/dist/pino.cjs.map CHANGED
@@ -1 +1 @@
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"}
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\t| string[]\n\t| {\n\t\t\tpaths: string[];\n\t\t\tcensor?: string | ((value: unknown, path: string[]) => unknown);\n\t\t\tremove?: boolean;\n\t };\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\tredact: boolean | RedactOptions | undefined,\n): PinoRedactConfig | undefined {\n\tif (redact === undefined || redact === false) {\n\t\treturn undefined;\n\t}\n\n\tif (redact === true) {\n\t\treturn DEFAULT_REDACT_PATHS;\n\t}\n\n\t// Array syntax - merge with defaults\n\tif (Array.isArray(redact)) {\n\t\treturn [...DEFAULT_REDACT_PATHS, ...redact];\n\t}\n\n\t// Object syntax - check resolution mode\n\tconst { resolution = 'merge', paths, censor, remove } = redact;\n\n\tconst resolvedPaths =\n\t\tresolution === 'override' ? paths : [...DEFAULT_REDACT_PATHS, ...paths];\n\n\t// Return clean pino config without our resolution field\n\tconst config: PinoRedactConfig = { paths: resolvedPaths };\n\tif (censor !== undefined) config.censor = censor;\n\tif (remove !== undefined) config.remove = remove;\n\n\treturn 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\t// @ts-expect-error\n\tconst pretty = options?.pretty && process.NODE_ENV !== 'production';\n\tconst baseOptions = pretty\n\t\t? {\n\t\t\t\ttransport: {\n\t\t\t\t\ttarget: 'pino-pretty',\n\t\t\t\t\toptions: { colorize: true },\n\t\t\t\t},\n\t\t\t}\n\t\t: {};\n\n\tconst redact = resolveRedactConfig(options.redact);\n\n\treturn pino({\n\t\t...baseOptions,\n\t\t...(options.level && { level: options.level }),\n\t\t...(redact && { redact }),\n\t\tformatters: {\n\t\t\tbindings() {\n\t\t\t\treturn { nodeVersion: process.version };\n\t\t\t},\n\t\t\tlevel: (label) => {\n\t\t\t\treturn { level: label.toUpperCase() };\n\t\t\t},\n\t\t},\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,SAAS,oBACRA,QAC+B;AAC/B,KAAI,qBAAwB,WAAW,MACtC;AAGD,KAAI,WAAW,KACd,QAAOC;AAIR,KAAI,MAAM,QAAQ,OAAO,CACxB,QAAO,CAAC,GAAGA,2CAAsB,GAAG,MAAO;CAI5C,MAAM,EAAE,aAAa,SAAS,OAAO,QAAQ,QAAQ,GAAG;CAExD,MAAM,gBACL,eAAe,aAAa,QAAQ,CAAC,GAAGA,2CAAsB,GAAG,KAAM;CAGxE,MAAMC,SAA2B,EAAE,OAAO,cAAe;AACzD,KAAI,kBAAsB,QAAO,SAAS;AAC1C,KAAI,kBAAsB,QAAO,SAAS;AAE1C,QAAO;AACP;;;;;;;;;;;;;;;;;;;AAoBD,SAAgB,aAAaC,UAA+B,CAAE,GAAE;CAE/D,MAAM,SAAS,SAAS,UAAU,QAAQ,aAAa;CACvD,MAAM,cAAc,SACjB,EACA,WAAW;EACV,QAAQ;EACR,SAAS,EAAE,UAAU,KAAM;CAC3B,EACD,IACA,CAAE;CAEL,MAAM,SAAS,oBAAoB,QAAQ,OAAO;AAElD,QAAO,eAAK;EACX,GAAG;EACH,GAAI,QAAQ,SAAS,EAAE,OAAO,QAAQ,MAAO;EAC7C,GAAI,UAAU,EAAE,OAAQ;EACxB,YAAY;GACX,WAAW;AACV,WAAO,EAAE,aAAa,QAAQ,QAAS;GACvC;GACD,OAAO,CAAC,UAAU;AACjB,WAAO,EAAE,OAAO,MAAM,aAAa,CAAE;GACrC;EACD;CACD,EAAC;AACF"}
package/dist/pino.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { CreateLoggerOptions } from "./types-JxCFymH0.cjs";
2
- import { DEFAULT_REDACT_PATHS } from "./redact-paths-Br-tI2GZ.cjs";
1
+ import { CreateLoggerOptions } from "./types-Dk_k2-f_.cjs";
2
+ import { DEFAULT_REDACT_PATHS } from "./redact-paths-CsK0_uz-.cjs";
3
3
  import * as pino0 from "pino";
4
4
 
5
5
  //#region src/pino.d.ts
@@ -23,6 +23,7 @@ import * as pino0 from "pino";
23
23
  * ```
24
24
  */
25
25
  declare function createLogger(options?: CreateLoggerOptions): pino0.Logger<never, boolean>;
26
+ //# sourceMappingURL=pino.d.ts.map
26
27
  //#endregion
27
28
  export { DEFAULT_REDACT_PATHS, createLogger };
28
29
  //# sourceMappingURL=pino.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pino.d.cts","names":[],"sources":["../src/pino.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAqGA;;;;AAA8D;;;;;;;;;;;iBAA9C,YAAA,WAAsB,sBAAwB,KAAA,CAAA"}
package/dist/pino.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { CreateLoggerOptions } from "./types-Bga8WDuP.mjs";
2
- import { DEFAULT_REDACT_PATHS } from "./redact-paths-CIsuxHH7.mjs";
1
+ import { CreateLoggerOptions } from "./types-BDdpcrpy.mjs";
2
+ import { DEFAULT_REDACT_PATHS } from "./redact-paths-D07eTMlH.mjs";
3
3
  import * as pino0 from "pino";
4
4
 
5
5
  //#region src/pino.d.ts
@@ -23,6 +23,7 @@ import * as pino0 from "pino";
23
23
  * ```
24
24
  */
25
25
  declare function createLogger(options?: CreateLoggerOptions): pino0.Logger<never, boolean>;
26
+ //# sourceMappingURL=pino.d.ts.map
26
27
  //#endregion
27
28
  export { DEFAULT_REDACT_PATHS, createLogger };
28
29
  //# sourceMappingURL=pino.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pino.d.mts","names":[],"sources":["../src/pino.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAqGA;;;;AAA8D;;;;;;;;;;;iBAA9C,YAAA,WAAsB,sBAAwB,KAAA,CAAA"}
package/dist/pino.mjs.map CHANGED
@@ -1 +1 @@
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"}
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\t| string[]\n\t| {\n\t\t\tpaths: string[];\n\t\t\tcensor?: string | ((value: unknown, path: string[]) => unknown);\n\t\t\tremove?: boolean;\n\t };\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\tredact: boolean | RedactOptions | undefined,\n): PinoRedactConfig | undefined {\n\tif (redact === undefined || redact === false) {\n\t\treturn undefined;\n\t}\n\n\tif (redact === true) {\n\t\treturn DEFAULT_REDACT_PATHS;\n\t}\n\n\t// Array syntax - merge with defaults\n\tif (Array.isArray(redact)) {\n\t\treturn [...DEFAULT_REDACT_PATHS, ...redact];\n\t}\n\n\t// Object syntax - check resolution mode\n\tconst { resolution = 'merge', paths, censor, remove } = redact;\n\n\tconst resolvedPaths =\n\t\tresolution === 'override' ? paths : [...DEFAULT_REDACT_PATHS, ...paths];\n\n\t// Return clean pino config without our resolution field\n\tconst config: PinoRedactConfig = { paths: resolvedPaths };\n\tif (censor !== undefined) config.censor = censor;\n\tif (remove !== undefined) config.remove = remove;\n\n\treturn 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\t// @ts-expect-error\n\tconst pretty = options?.pretty && process.NODE_ENV !== 'production';\n\tconst baseOptions = pretty\n\t\t? {\n\t\t\t\ttransport: {\n\t\t\t\t\ttarget: 'pino-pretty',\n\t\t\t\t\toptions: { colorize: true },\n\t\t\t\t},\n\t\t\t}\n\t\t: {};\n\n\tconst redact = resolveRedactConfig(options.redact);\n\n\treturn pino({\n\t\t...baseOptions,\n\t\t...(options.level && { level: options.level }),\n\t\t...(redact && { redact }),\n\t\tformatters: {\n\t\t\tbindings() {\n\t\t\t\treturn { nodeVersion: process.version };\n\t\t\t},\n\t\t\tlevel: (label) => {\n\t\t\t\treturn { level: label.toUpperCase() };\n\t\t\t},\n\t\t},\n\t});\n}\n"],"mappings":";;;;;;;;;;;AAqDA,SAAS,oBACRA,QAC+B;AAC/B,KAAI,qBAAwB,WAAW,MACtC;AAGD,KAAI,WAAW,KACd,QAAO;AAIR,KAAI,MAAM,QAAQ,OAAO,CACxB,QAAO,CAAC,GAAG,sBAAsB,GAAG,MAAO;CAI5C,MAAM,EAAE,aAAa,SAAS,OAAO,QAAQ,QAAQ,GAAG;CAExD,MAAM,gBACL,eAAe,aAAa,QAAQ,CAAC,GAAG,sBAAsB,GAAG,KAAM;CAGxE,MAAMC,SAA2B,EAAE,OAAO,cAAe;AACzD,KAAI,kBAAsB,QAAO,SAAS;AAC1C,KAAI,kBAAsB,QAAO,SAAS;AAE1C,QAAO;AACP;;;;;;;;;;;;;;;;;;;AAoBD,SAAgB,aAAaC,UAA+B,CAAE,GAAE;CAE/D,MAAM,SAAS,SAAS,UAAU,QAAQ,aAAa;CACvD,MAAM,cAAc,SACjB,EACA,WAAW;EACV,QAAQ;EACR,SAAS,EAAE,UAAU,KAAM;CAC3B,EACD,IACA,CAAE;CAEL,MAAM,SAAS,oBAAoB,QAAQ,OAAO;AAElD,QAAO,KAAK;EACX,GAAG;EACH,GAAI,QAAQ,SAAS,EAAE,OAAO,QAAQ,MAAO;EAC7C,GAAI,UAAU,EAAE,OAAQ;EACxB,YAAY;GACX,WAAW;AACV,WAAO,EAAE,aAAa,QAAQ,QAAS;GACvC;GACD,OAAO,CAAC,UAAU;AACjB,WAAO,EAAE,OAAO,MAAM,aAAa,CAAE;GACrC;EACD;CACD,EAAC;AACF"}
@@ -13,6 +13,7 @@
13
13
  * - Wildcards: *.password, *.secret, *.token (catches nested fields)
14
14
  */
15
15
  declare const DEFAULT_REDACT_PATHS: string[];
16
+ //# sourceMappingURL=redact-paths.d.ts.map
16
17
  //#endregion
17
18
  export { DEFAULT_REDACT_PATHS };
18
- //# sourceMappingURL=redact-paths-Br-tI2GZ.d.cts.map
19
+ //# sourceMappingURL=redact-paths-CsK0_uz-.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redact-paths-CsK0_uz-.d.cts","names":[],"sources":["../src/redact-paths.ts"],"sourcesContent":[],"mappings":";;AAaA;;;;;;;;;;;;cAAa"}
@@ -13,6 +13,7 @@
13
13
  * - Wildcards: *.password, *.secret, *.token (catches nested fields)
14
14
  */
15
15
  declare const DEFAULT_REDACT_PATHS: string[];
16
+ //# sourceMappingURL=redact-paths.d.ts.map
16
17
  //#endregion
17
18
  export { DEFAULT_REDACT_PATHS };
18
- //# sourceMappingURL=redact-paths-CIsuxHH7.d.mts.map
19
+ //# sourceMappingURL=redact-paths-D07eTMlH.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redact-paths-D07eTMlH.d.mts","names":[],"sources":["../src/redact-paths.ts"],"sourcesContent":[],"mappings":";;AAaA;;;;;;;;;;;;cAAa"}
@@ -1 +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"}
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\t// Authentication & authorization\n\t'password',\n\t'pass',\n\t'passwd',\n\t'secret',\n\t'token',\n\t'accessToken',\n\t'refreshToken',\n\t'idToken',\n\t'apiKey',\n\t'api_key',\n\t'apikey',\n\t'auth',\n\t'authorization',\n\t'credential',\n\t'credentials',\n\n\t// Common nested patterns (headers, body, etc.)\n\t'*.password',\n\t'*.secret',\n\t'*.token',\n\t'*.apiKey',\n\t'*.api_key',\n\t'*.authorization',\n\t'*.accessToken',\n\t'*.refreshToken',\n\n\t// HTTP headers (case variations)\n\t'headers.authorization',\n\t'headers.Authorization',\n\t'headers[\"authorization\"]',\n\t'headers[\"Authorization\"]',\n\t'headers.cookie',\n\t'headers.Cookie',\n\t'headers[\"x-api-key\"]',\n\t'headers[\"X-Api-Key\"]',\n\t'headers[\"x-auth-token\"]',\n\t'headers[\"X-Auth-Token\"]',\n\n\t// Common sensitive data fields\n\t'ssn',\n\t'socialSecurityNumber',\n\t'social_security_number',\n\t'creditCard',\n\t'credit_card',\n\t'cardNumber',\n\t'card_number',\n\t'cvv',\n\t'cvc',\n\t'pin',\n\n\t// Database & connection strings\n\t'connectionString',\n\t'connection_string',\n\t'databaseUrl',\n\t'database_url',\n];\n"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAaA,uBAAiC;CAE7C;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;AACA"}
@@ -1 +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"}
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\t// Authentication & authorization\n\t'password',\n\t'pass',\n\t'passwd',\n\t'secret',\n\t'token',\n\t'accessToken',\n\t'refreshToken',\n\t'idToken',\n\t'apiKey',\n\t'api_key',\n\t'apikey',\n\t'auth',\n\t'authorization',\n\t'credential',\n\t'credentials',\n\n\t// Common nested patterns (headers, body, etc.)\n\t'*.password',\n\t'*.secret',\n\t'*.token',\n\t'*.apiKey',\n\t'*.api_key',\n\t'*.authorization',\n\t'*.accessToken',\n\t'*.refreshToken',\n\n\t// HTTP headers (case variations)\n\t'headers.authorization',\n\t'headers.Authorization',\n\t'headers[\"authorization\"]',\n\t'headers[\"Authorization\"]',\n\t'headers.cookie',\n\t'headers.Cookie',\n\t'headers[\"x-api-key\"]',\n\t'headers[\"X-Api-Key\"]',\n\t'headers[\"x-auth-token\"]',\n\t'headers[\"X-Auth-Token\"]',\n\n\t// Common sensitive data fields\n\t'ssn',\n\t'socialSecurityNumber',\n\t'social_security_number',\n\t'creditCard',\n\t'credit_card',\n\t'cardNumber',\n\t'card_number',\n\t'cvv',\n\t'cvc',\n\t'pin',\n\n\t// Database & connection strings\n\t'connectionString',\n\t'connection_string',\n\t'databaseUrl',\n\t'database_url',\n];\n"],"mappings":";;;;;;;;;;;;;;AAaA,MAAaA,uBAAiC;CAE7C;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;AACA"}
@@ -1,2 +1,2 @@
1
- import { DEFAULT_REDACT_PATHS } from "./redact-paths-Br-tI2GZ.cjs";
1
+ import { DEFAULT_REDACT_PATHS } from "./redact-paths-CsK0_uz-.cjs";
2
2
  export { DEFAULT_REDACT_PATHS };
@@ -1,2 +1,2 @@
1
- import { DEFAULT_REDACT_PATHS } from "./redact-paths-CIsuxHH7.mjs";
1
+ import { DEFAULT_REDACT_PATHS } from "./redact-paths-D07eTMlH.mjs";
2
2
  export { DEFAULT_REDACT_PATHS };
@@ -160,6 +160,7 @@ type CreateLoggerOptions = {
160
160
  */
161
161
  redact?: boolean | RedactOptions;
162
162
  };
163
+ //# sourceMappingURL=types.d.ts.map
163
164
  //#endregion
164
165
  export { CreateLoggerOptions, LogFn, LogLevel, Logger, RedactOptions };
165
- //# sourceMappingURL=types-Bga8WDuP.d.mts.map
166
+ //# sourceMappingURL=types-BDdpcrpy.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-BDdpcrpy.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;AAaA;AAaA;;;;;;;;;AAoB+B;AAoB/B;AAyCY,KA9FA,KAAA,GA8Fa;EAiBb;EAAmB,CAAA,UAAA,MAAA,CAAA,CAAA,GAAA,EA7GN,CA6GM,EAAA,GAAA,CAAA,EAAA,MAAA,EAAA,GAAA,IAAA,EAAA,GAAA,EAAA,CAAA,EAAA,IAAA;EAAA;EAId,CAAA,GAqCG,EAAA,MAAA,CAAA,EAAA,IAAA;AAAa,CAAA;;;;;;;UA3IhB,MAAA;;SAET;;QAED;;QAEA;;SAEC;;SAEA;;SAEA;;;;;;;;0BAQiB;;;;;;;;;;;;;;;;;;;aAoBb,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyCA,aAAA;;;;;;;;;;;;;;KAiBA,mBAAA;;;;UAIH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAqCW"}
@@ -160,6 +160,7 @@ type CreateLoggerOptions = {
160
160
  */
161
161
  redact?: boolean | RedactOptions;
162
162
  };
163
+ //# sourceMappingURL=types.d.ts.map
163
164
  //#endregion
164
165
  export { CreateLoggerOptions, LogFn, LogLevel, Logger, RedactOptions };
165
- //# sourceMappingURL=types-JxCFymH0.d.cts.map
166
+ //# sourceMappingURL=types-Dk_k2-f_.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-Dk_k2-f_.d.cts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;AAaA;AAaA;;;;;;;;;AAoB+B;AAoB/B;AAyCY,KA9FA,KAAA,GA8Fa;EAiBb;EAAmB,CAAA,UAAA,MAAA,CAAA,CAAA,GAAA,EA7GN,CA6GM,EAAA,GAAA,CAAA,EAAA,MAAA,EAAA,GAAA,IAAA,EAAA,GAAA,EAAA,CAAA,EAAA,IAAA;EAAA;EAId,CAAA,GAqCG,EAAA,MAAA,CAAA,EAAA,IAAA;AAAa,CAAA;;;;;;;UA3IhB,MAAA;;SAET;;QAED;;QAEA;;SAEC;;SAEA;;SAEA;;;;;;;;0BAQiB;;;;;;;;;;;;;;;;;;;aAoBb,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyCA,aAAA;;;;;;;;;;;;;;KAiBA,mBAAA;;;;UAIH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAqCW"}
@@ -1 +1 @@
1
- {"version":3,"file":"types-ag_0Cvbg.cjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["/**\n * Logging function type that supports both structured and simple logging.\n * Can be called with an object for structured logging or just a message string.\n *\n * @example\n * ```typescript\n * // Structured logging with context object\n * logger.info({ userId: 123, action: 'login' }, 'User logged in');\n *\n * // Simple string logging\n * logger.info('Application started');\n * ```\n */\nexport type LogFn = {\n /** Structured logging with context object, optional message, and additional arguments */\n <T extends object>(obj: T, msg?: string, ...args: any[]): void;\n /** Simple string logging */\n (msg: string): void;\n};\n\n/**\n * Standard logger interface with multiple log levels and child logger support.\n * Follows common logging patterns with structured logging capabilities.\n *\n * @interface Logger\n */\nexport interface Logger {\n /** Debug level logging - verbose information for debugging */\n debug: LogFn;\n /** Info level logging - general informational messages */\n info: LogFn;\n /** Warning level logging - potentially harmful situations */\n warn: LogFn;\n /** Error level logging - error events that might still allow the application to continue */\n error: LogFn;\n /** Fatal level logging - severe errors that will likely cause the application to abort */\n fatal: LogFn;\n /** Trace level logging - most detailed information */\n trace: LogFn;\n /**\n * Creates a child logger with additional context.\n * Child loggers inherit parent context and add their own.\n *\n * @param obj - Additional context to include in all child logger calls\n * @returns A new Logger instance with merged context\n */\n child: (obj: object) => Logger;\n}\n\n/**\n * Console-based logger implementation that outputs to standard console methods.\n * Supports structured logging with automatic timestamp injection and context inheritance.\n *\n * @implements {Logger}\n *\n * @example\n * ```typescript\n * const logger = new ConsoleLogger({ app: 'myApp', version: '1.0.0' });\n * logger.info({ userId: 123 }, 'User action performed');\n * // Output: { app: 'myApp', version: '1.0.0', userId: 123, ts: 1234567890 } User action performed\n *\n * const childLogger = logger.child({ module: 'auth' });\n * childLogger.debug({ action: 'validate' }, 'Validating token');\n * // Output: { app: 'myApp', version: '1.0.0', module: 'auth', action: 'validate', ts: 1234567891 } Validating token\n * ```\n */\nexport enum LogLevel {\n Trace = 'trace',\n Debug = 'debug',\n Info = 'info',\n Warn = 'warn',\n Error = 'error',\n Fatal = 'fatal',\n Silent = 'silent',\n}\n\n/**\n * Redaction configuration for masking sensitive data in logs.\n * Uses pino's fast-redact library under the hood.\n *\n * By default, custom paths are merged with the default sensitive paths.\n * Use `resolution: 'override'` to use only your custom paths.\n *\n * @example\n * ```typescript\n * // Simple path array (merges with defaults)\n * redact: ['user.ssn', 'custom.field']\n *\n * // Override defaults completely\n * redact: {\n * paths: ['only.these.paths'],\n * resolution: 'override',\n * }\n *\n * // With custom censor\n * redact: {\n * paths: ['extra.secret'],\n * censor: '***',\n * }\n *\n * // Remove fields entirely\n * redact: {\n * paths: ['temporary.data'],\n * remove: true,\n * }\n * ```\n */\nexport type RedactOptions =\n | string[]\n | {\n /** Paths to redact using dot notation or bracket notation for special chars */\n paths: string[];\n /** Custom replacement text (default: '[REDACTED]') */\n censor?: string | ((value: unknown, path: string[]) => unknown);\n /** Remove the field entirely instead of replacing (default: false) */\n remove?: boolean;\n /**\n * How to combine custom paths with default sensitive paths.\n * - 'merge': Custom paths are added to default paths (default)\n * - 'override': Only custom paths are used, defaults are ignored\n */\n resolution?: 'merge' | 'override';\n };\n\nexport type CreateLoggerOptions = {\n /** Enable pretty printing with colors (disabled in production) */\n pretty?: boolean;\n /** Minimum log level to output */\n level?: LogLevel;\n /**\n * Redaction configuration for masking sensitive data.\n *\n * - `true`: Uses default sensitive paths (password, token, secret, etc.)\n * - `false` or `undefined`: No redaction applied\n * - `string[]`: Custom paths merged with defaults\n * - `object`: Advanced config with paths, censor, remove, and resolution options\n *\n * By default, custom paths are **merged** with the default sensitive paths.\n * Use `resolution: 'override'` to disable defaults and use only your paths.\n *\n * @example\n * ```typescript\n * // Use defaults only\n * createLogger({ redact: true });\n *\n * // Add custom paths (merged with defaults)\n * createLogger({ redact: ['user.ssn', 'custom.field'] });\n *\n * // Override defaults completely\n * createLogger({\n * redact: {\n * paths: ['only.these.paths'],\n * resolution: 'override',\n * }\n * });\n *\n * // Merge with custom censor\n * createLogger({\n * redact: {\n * paths: ['extra.secret'],\n * censor: '***',\n * }\n * });\n * ```\n */\n redact?: boolean | RedactOptions;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkEA,IAAY,gDAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AACD"}
1
+ {"version":3,"file":"types-ag_0Cvbg.cjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["/**\n * Logging function type that supports both structured and simple logging.\n * Can be called with an object for structured logging or just a message string.\n *\n * @example\n * ```typescript\n * // Structured logging with context object\n * logger.info({ userId: 123, action: 'login' }, 'User logged in');\n *\n * // Simple string logging\n * logger.info('Application started');\n * ```\n */\nexport type LogFn = {\n\t/** Structured logging with context object, optional message, and additional arguments */\n\t<T extends object>(obj: T, msg?: string, ...args: any[]): void;\n\t/** Simple string logging */\n\t(msg: string): void;\n};\n\n/**\n * Standard logger interface with multiple log levels and child logger support.\n * Follows common logging patterns with structured logging capabilities.\n *\n * @interface Logger\n */\nexport interface Logger {\n\t/** Debug level logging - verbose information for debugging */\n\tdebug: LogFn;\n\t/** Info level logging - general informational messages */\n\tinfo: LogFn;\n\t/** Warning level logging - potentially harmful situations */\n\twarn: LogFn;\n\t/** Error level logging - error events that might still allow the application to continue */\n\terror: LogFn;\n\t/** Fatal level logging - severe errors that will likely cause the application to abort */\n\tfatal: LogFn;\n\t/** Trace level logging - most detailed information */\n\ttrace: LogFn;\n\t/**\n\t * Creates a child logger with additional context.\n\t * Child loggers inherit parent context and add their own.\n\t *\n\t * @param obj - Additional context to include in all child logger calls\n\t * @returns A new Logger instance with merged context\n\t */\n\tchild: (obj: object) => Logger;\n}\n\n/**\n * Console-based logger implementation that outputs to standard console methods.\n * Supports structured logging with automatic timestamp injection and context inheritance.\n *\n * @implements {Logger}\n *\n * @example\n * ```typescript\n * const logger = new ConsoleLogger({ app: 'myApp', version: '1.0.0' });\n * logger.info({ userId: 123 }, 'User action performed');\n * // Output: { app: 'myApp', version: '1.0.0', userId: 123, ts: 1234567890 } User action performed\n *\n * const childLogger = logger.child({ module: 'auth' });\n * childLogger.debug({ action: 'validate' }, 'Validating token');\n * // Output: { app: 'myApp', version: '1.0.0', module: 'auth', action: 'validate', ts: 1234567891 } Validating token\n * ```\n */\nexport enum LogLevel {\n\tTrace = 'trace',\n\tDebug = 'debug',\n\tInfo = 'info',\n\tWarn = 'warn',\n\tError = 'error',\n\tFatal = 'fatal',\n\tSilent = 'silent',\n}\n\n/**\n * Redaction configuration for masking sensitive data in logs.\n * Uses pino's fast-redact library under the hood.\n *\n * By default, custom paths are merged with the default sensitive paths.\n * Use `resolution: 'override'` to use only your custom paths.\n *\n * @example\n * ```typescript\n * // Simple path array (merges with defaults)\n * redact: ['user.ssn', 'custom.field']\n *\n * // Override defaults completely\n * redact: {\n * paths: ['only.these.paths'],\n * resolution: 'override',\n * }\n *\n * // With custom censor\n * redact: {\n * paths: ['extra.secret'],\n * censor: '***',\n * }\n *\n * // Remove fields entirely\n * redact: {\n * paths: ['temporary.data'],\n * remove: true,\n * }\n * ```\n */\nexport type RedactOptions =\n\t| string[]\n\t| {\n\t\t\t/** Paths to redact using dot notation or bracket notation for special chars */\n\t\t\tpaths: string[];\n\t\t\t/** Custom replacement text (default: '[REDACTED]') */\n\t\t\tcensor?: string | ((value: unknown, path: string[]) => unknown);\n\t\t\t/** Remove the field entirely instead of replacing (default: false) */\n\t\t\tremove?: boolean;\n\t\t\t/**\n\t\t\t * How to combine custom paths with default sensitive paths.\n\t\t\t * - 'merge': Custom paths are added to default paths (default)\n\t\t\t * - 'override': Only custom paths are used, defaults are ignored\n\t\t\t */\n\t\t\tresolution?: 'merge' | 'override';\n\t };\n\nexport type CreateLoggerOptions = {\n\t/** Enable pretty printing with colors (disabled in production) */\n\tpretty?: boolean;\n\t/** Minimum log level to output */\n\tlevel?: LogLevel;\n\t/**\n\t * Redaction configuration for masking sensitive data.\n\t *\n\t * - `true`: Uses default sensitive paths (password, token, secret, etc.)\n\t * - `false` or `undefined`: No redaction applied\n\t * - `string[]`: Custom paths merged with defaults\n\t * - `object`: Advanced config with paths, censor, remove, and resolution options\n\t *\n\t * By default, custom paths are **merged** with the default sensitive paths.\n\t * Use `resolution: 'override'` to disable defaults and use only your paths.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Use defaults only\n\t * createLogger({ redact: true });\n\t *\n\t * // Add custom paths (merged with defaults)\n\t * createLogger({ redact: ['user.ssn', 'custom.field'] });\n\t *\n\t * // Override defaults completely\n\t * createLogger({\n\t * redact: {\n\t * paths: ['only.these.paths'],\n\t * resolution: 'override',\n\t * }\n\t * });\n\t *\n\t * // Merge with custom censor\n\t * createLogger({\n\t * redact: {\n\t * paths: ['extra.secret'],\n\t * censor: '***',\n\t * }\n\t * });\n\t * ```\n\t */\n\tredact?: boolean | RedactOptions;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkEA,IAAY,gDAAL;AACN;AACA;AACA;AACA;AACA;AACA;AACA;;AACA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types-yQ6XOihF.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["/**\n * Logging function type that supports both structured and simple logging.\n * Can be called with an object for structured logging or just a message string.\n *\n * @example\n * ```typescript\n * // Structured logging with context object\n * logger.info({ userId: 123, action: 'login' }, 'User logged in');\n *\n * // Simple string logging\n * logger.info('Application started');\n * ```\n */\nexport type LogFn = {\n /** Structured logging with context object, optional message, and additional arguments */\n <T extends object>(obj: T, msg?: string, ...args: any[]): void;\n /** Simple string logging */\n (msg: string): void;\n};\n\n/**\n * Standard logger interface with multiple log levels and child logger support.\n * Follows common logging patterns with structured logging capabilities.\n *\n * @interface Logger\n */\nexport interface Logger {\n /** Debug level logging - verbose information for debugging */\n debug: LogFn;\n /** Info level logging - general informational messages */\n info: LogFn;\n /** Warning level logging - potentially harmful situations */\n warn: LogFn;\n /** Error level logging - error events that might still allow the application to continue */\n error: LogFn;\n /** Fatal level logging - severe errors that will likely cause the application to abort */\n fatal: LogFn;\n /** Trace level logging - most detailed information */\n trace: LogFn;\n /**\n * Creates a child logger with additional context.\n * Child loggers inherit parent context and add their own.\n *\n * @param obj - Additional context to include in all child logger calls\n * @returns A new Logger instance with merged context\n */\n child: (obj: object) => Logger;\n}\n\n/**\n * Console-based logger implementation that outputs to standard console methods.\n * Supports structured logging with automatic timestamp injection and context inheritance.\n *\n * @implements {Logger}\n *\n * @example\n * ```typescript\n * const logger = new ConsoleLogger({ app: 'myApp', version: '1.0.0' });\n * logger.info({ userId: 123 }, 'User action performed');\n * // Output: { app: 'myApp', version: '1.0.0', userId: 123, ts: 1234567890 } User action performed\n *\n * const childLogger = logger.child({ module: 'auth' });\n * childLogger.debug({ action: 'validate' }, 'Validating token');\n * // Output: { app: 'myApp', version: '1.0.0', module: 'auth', action: 'validate', ts: 1234567891 } Validating token\n * ```\n */\nexport enum LogLevel {\n Trace = 'trace',\n Debug = 'debug',\n Info = 'info',\n Warn = 'warn',\n Error = 'error',\n Fatal = 'fatal',\n Silent = 'silent',\n}\n\n/**\n * Redaction configuration for masking sensitive data in logs.\n * Uses pino's fast-redact library under the hood.\n *\n * By default, custom paths are merged with the default sensitive paths.\n * Use `resolution: 'override'` to use only your custom paths.\n *\n * @example\n * ```typescript\n * // Simple path array (merges with defaults)\n * redact: ['user.ssn', 'custom.field']\n *\n * // Override defaults completely\n * redact: {\n * paths: ['only.these.paths'],\n * resolution: 'override',\n * }\n *\n * // With custom censor\n * redact: {\n * paths: ['extra.secret'],\n * censor: '***',\n * }\n *\n * // Remove fields entirely\n * redact: {\n * paths: ['temporary.data'],\n * remove: true,\n * }\n * ```\n */\nexport type RedactOptions =\n | string[]\n | {\n /** Paths to redact using dot notation or bracket notation for special chars */\n paths: string[];\n /** Custom replacement text (default: '[REDACTED]') */\n censor?: string | ((value: unknown, path: string[]) => unknown);\n /** Remove the field entirely instead of replacing (default: false) */\n remove?: boolean;\n /**\n * How to combine custom paths with default sensitive paths.\n * - 'merge': Custom paths are added to default paths (default)\n * - 'override': Only custom paths are used, defaults are ignored\n */\n resolution?: 'merge' | 'override';\n };\n\nexport type CreateLoggerOptions = {\n /** Enable pretty printing with colors (disabled in production) */\n pretty?: boolean;\n /** Minimum log level to output */\n level?: LogLevel;\n /**\n * Redaction configuration for masking sensitive data.\n *\n * - `true`: Uses default sensitive paths (password, token, secret, etc.)\n * - `false` or `undefined`: No redaction applied\n * - `string[]`: Custom paths merged with defaults\n * - `object`: Advanced config with paths, censor, remove, and resolution options\n *\n * By default, custom paths are **merged** with the default sensitive paths.\n * Use `resolution: 'override'` to disable defaults and use only your paths.\n *\n * @example\n * ```typescript\n * // Use defaults only\n * createLogger({ redact: true });\n *\n * // Add custom paths (merged with defaults)\n * createLogger({ redact: ['user.ssn', 'custom.field'] });\n *\n * // Override defaults completely\n * createLogger({\n * redact: {\n * paths: ['only.these.paths'],\n * resolution: 'override',\n * }\n * });\n *\n * // Merge with custom censor\n * createLogger({\n * redact: {\n * paths: ['extra.secret'],\n * censor: '***',\n * }\n * });\n * ```\n */\n redact?: boolean | RedactOptions;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkEA,IAAY,gDAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AACD"}
1
+ {"version":3,"file":"types-yQ6XOihF.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["/**\n * Logging function type that supports both structured and simple logging.\n * Can be called with an object for structured logging or just a message string.\n *\n * @example\n * ```typescript\n * // Structured logging with context object\n * logger.info({ userId: 123, action: 'login' }, 'User logged in');\n *\n * // Simple string logging\n * logger.info('Application started');\n * ```\n */\nexport type LogFn = {\n\t/** Structured logging with context object, optional message, and additional arguments */\n\t<T extends object>(obj: T, msg?: string, ...args: any[]): void;\n\t/** Simple string logging */\n\t(msg: string): void;\n};\n\n/**\n * Standard logger interface with multiple log levels and child logger support.\n * Follows common logging patterns with structured logging capabilities.\n *\n * @interface Logger\n */\nexport interface Logger {\n\t/** Debug level logging - verbose information for debugging */\n\tdebug: LogFn;\n\t/** Info level logging - general informational messages */\n\tinfo: LogFn;\n\t/** Warning level logging - potentially harmful situations */\n\twarn: LogFn;\n\t/** Error level logging - error events that might still allow the application to continue */\n\terror: LogFn;\n\t/** Fatal level logging - severe errors that will likely cause the application to abort */\n\tfatal: LogFn;\n\t/** Trace level logging - most detailed information */\n\ttrace: LogFn;\n\t/**\n\t * Creates a child logger with additional context.\n\t * Child loggers inherit parent context and add their own.\n\t *\n\t * @param obj - Additional context to include in all child logger calls\n\t * @returns A new Logger instance with merged context\n\t */\n\tchild: (obj: object) => Logger;\n}\n\n/**\n * Console-based logger implementation that outputs to standard console methods.\n * Supports structured logging with automatic timestamp injection and context inheritance.\n *\n * @implements {Logger}\n *\n * @example\n * ```typescript\n * const logger = new ConsoleLogger({ app: 'myApp', version: '1.0.0' });\n * logger.info({ userId: 123 }, 'User action performed');\n * // Output: { app: 'myApp', version: '1.0.0', userId: 123, ts: 1234567890 } User action performed\n *\n * const childLogger = logger.child({ module: 'auth' });\n * childLogger.debug({ action: 'validate' }, 'Validating token');\n * // Output: { app: 'myApp', version: '1.0.0', module: 'auth', action: 'validate', ts: 1234567891 } Validating token\n * ```\n */\nexport enum LogLevel {\n\tTrace = 'trace',\n\tDebug = 'debug',\n\tInfo = 'info',\n\tWarn = 'warn',\n\tError = 'error',\n\tFatal = 'fatal',\n\tSilent = 'silent',\n}\n\n/**\n * Redaction configuration for masking sensitive data in logs.\n * Uses pino's fast-redact library under the hood.\n *\n * By default, custom paths are merged with the default sensitive paths.\n * Use `resolution: 'override'` to use only your custom paths.\n *\n * @example\n * ```typescript\n * // Simple path array (merges with defaults)\n * redact: ['user.ssn', 'custom.field']\n *\n * // Override defaults completely\n * redact: {\n * paths: ['only.these.paths'],\n * resolution: 'override',\n * }\n *\n * // With custom censor\n * redact: {\n * paths: ['extra.secret'],\n * censor: '***',\n * }\n *\n * // Remove fields entirely\n * redact: {\n * paths: ['temporary.data'],\n * remove: true,\n * }\n * ```\n */\nexport type RedactOptions =\n\t| string[]\n\t| {\n\t\t\t/** Paths to redact using dot notation or bracket notation for special chars */\n\t\t\tpaths: string[];\n\t\t\t/** Custom replacement text (default: '[REDACTED]') */\n\t\t\tcensor?: string | ((value: unknown, path: string[]) => unknown);\n\t\t\t/** Remove the field entirely instead of replacing (default: false) */\n\t\t\tremove?: boolean;\n\t\t\t/**\n\t\t\t * How to combine custom paths with default sensitive paths.\n\t\t\t * - 'merge': Custom paths are added to default paths (default)\n\t\t\t * - 'override': Only custom paths are used, defaults are ignored\n\t\t\t */\n\t\t\tresolution?: 'merge' | 'override';\n\t };\n\nexport type CreateLoggerOptions = {\n\t/** Enable pretty printing with colors (disabled in production) */\n\tpretty?: boolean;\n\t/** Minimum log level to output */\n\tlevel?: LogLevel;\n\t/**\n\t * Redaction configuration for masking sensitive data.\n\t *\n\t * - `true`: Uses default sensitive paths (password, token, secret, etc.)\n\t * - `false` or `undefined`: No redaction applied\n\t * - `string[]`: Custom paths merged with defaults\n\t * - `object`: Advanced config with paths, censor, remove, and resolution options\n\t *\n\t * By default, custom paths are **merged** with the default sensitive paths.\n\t * Use `resolution: 'override'` to disable defaults and use only your paths.\n\t *\n\t * @example\n\t * ```typescript\n\t * // Use defaults only\n\t * createLogger({ redact: true });\n\t *\n\t * // Add custom paths (merged with defaults)\n\t * createLogger({ redact: ['user.ssn', 'custom.field'] });\n\t *\n\t * // Override defaults completely\n\t * createLogger({\n\t * redact: {\n\t * paths: ['only.these.paths'],\n\t * resolution: 'override',\n\t * }\n\t * });\n\t *\n\t * // Merge with custom censor\n\t * createLogger({\n\t * redact: {\n\t * paths: ['extra.secret'],\n\t * censor: '***',\n\t * }\n\t * });\n\t * ```\n\t */\n\tredact?: boolean | RedactOptions;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkEA,IAAY,gDAAL;AACN;AACA;AACA;AACA;AACA;AACA;AACA;;AACA"}
package/dist/types.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { CreateLoggerOptions, LogFn, LogLevel, Logger, RedactOptions } from "./types-JxCFymH0.cjs";
1
+ import { CreateLoggerOptions, LogFn, LogLevel, Logger, RedactOptions } from "./types-Dk_k2-f_.cjs";
2
2
  export { CreateLoggerOptions, LogFn, LogLevel, Logger, RedactOptions };
package/dist/types.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { CreateLoggerOptions, LogFn, LogLevel, Logger, RedactOptions } from "./types-Bga8WDuP.mjs";
1
+ import { CreateLoggerOptions, LogFn, LogLevel, Logger, RedactOptions } from "./types-BDdpcrpy.mjs";
2
2
  export { CreateLoggerOptions, LogFn, LogLevel, Logger, RedactOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geekmidas/logger",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "A simple and flexible logging library for Node.js and the browser",
5
5
  "private": false,
6
6
  "type": "module",