standard-log 11.5.1 → 12.0.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 (157) hide show
  1. package/README.md +2 -3
  2. package/cjs/console.d.ts +3 -3
  3. package/cjs/console.d.ts.map +1 -1
  4. package/cjs/console.js +18 -9
  5. package/cjs/console.js.map +1 -1
  6. package/cjs/errors.d.ts.map +1 -1
  7. package/cjs/errors.js.map +1 -1
  8. package/cjs/formatter.d.ts +1 -1
  9. package/cjs/formatter.d.ts.map +1 -1
  10. package/cjs/formatter.js +2 -2
  11. package/cjs/formatter.js.map +1 -1
  12. package/cjs/index.d.ts +4 -4
  13. package/cjs/index.d.ts.map +1 -1
  14. package/cjs/index.js +7 -8
  15. package/cjs/index.js.map +1 -1
  16. package/cjs/{logLevels.d.ts → log_levels.d.ts} +1 -1
  17. package/cjs/log_levels.d.ts.map +1 -0
  18. package/cjs/{logLevels.js → log_levels.js} +1 -1
  19. package/cjs/log_levels.js.map +1 -0
  20. package/{esm/logStore.d.ts → cjs/log_store.d.ts} +1 -1
  21. package/cjs/log_store.d.ts.map +1 -0
  22. package/cjs/{logStore.js → log_store.js} +6 -6
  23. package/cjs/log_store.js.map +1 -0
  24. package/cjs/logger.d.ts +1 -1
  25. package/cjs/logger.d.ts.map +1 -1
  26. package/cjs/logger.js +16 -14
  27. package/cjs/logger.js.map +1 -1
  28. package/cjs/memory.d.ts +2 -2
  29. package/cjs/memory.d.ts.map +1 -1
  30. package/cjs/memory.js +15 -8
  31. package/cjs/memory.js.map +1 -1
  32. package/cjs/platform.d.ts.map +1 -1
  33. package/cjs/platform.js +1 -2
  34. package/cjs/platform.js.map +1 -1
  35. package/cjs/{standardLog.ctx.d.ts → standard_log.ctx.d.ts} +2 -2
  36. package/cjs/standard_log.ctx.d.ts.map +1 -0
  37. package/cjs/{standardLog.ctx.js → standard_log.ctx.js} +1 -1
  38. package/cjs/standard_log.ctx.js.map +1 -0
  39. package/{esm/standardLog.d.ts → cjs/standard_log.d.ts} +4 -9
  40. package/cjs/standard_log.d.ts.map +1 -0
  41. package/cjs/{standardLog.js → standard_log.js} +37 -40
  42. package/cjs/standard_log.js.map +1 -0
  43. package/cjs/standard_log.mocks.d.ts +8 -0
  44. package/cjs/standard_log.mocks.d.ts.map +1 -0
  45. package/cjs/standard_log.mocks.js +32 -0
  46. package/cjs/standard_log.mocks.js.map +1 -0
  47. package/cjs/test_utils.d.ts +10 -0
  48. package/cjs/test_utils.d.ts.map +1 -0
  49. package/cjs/test_utils.js +25 -0
  50. package/cjs/test_utils.js.map +1 -0
  51. package/cjs/testing/index.d.ts +2 -0
  52. package/cjs/testing/index.d.ts.map +1 -0
  53. package/cjs/testing/index.js +6 -0
  54. package/cjs/testing/index.js.map +1 -0
  55. package/cjs/types.d.ts +12 -12
  56. package/cjs/types.d.ts.map +1 -1
  57. package/cjs/types.js.map +1 -1
  58. package/dist/standard-log.es5.js +1139 -758
  59. package/dist/standard-log.es5.js.gz +0 -0
  60. package/dist/standard-log.es5.js.map +1 -1
  61. package/dist/standard-log.es5.js.map.gz +0 -0
  62. package/dist/standard-log.esm.js +220 -175
  63. package/dist/standard-log.esm.js.gz +0 -0
  64. package/dist/standard-log.esm.js.map +1 -1
  65. package/dist/standard-log.esm.js.map.gz +0 -0
  66. package/esm/console.d.ts +3 -3
  67. package/esm/console.d.ts.map +1 -1
  68. package/esm/console.js +21 -10
  69. package/esm/console.js.map +1 -1
  70. package/esm/errors.d.ts.map +1 -1
  71. package/esm/errors.js.map +1 -1
  72. package/esm/formatter.d.ts +1 -1
  73. package/esm/formatter.d.ts.map +1 -1
  74. package/esm/formatter.js +1 -1
  75. package/esm/formatter.js.map +1 -1
  76. package/esm/index.d.ts +4 -4
  77. package/esm/index.d.ts.map +1 -1
  78. package/esm/index.js +2 -2
  79. package/esm/index.js.map +1 -1
  80. package/esm/{logLevels.d.ts → log_levels.d.ts} +1 -1
  81. package/esm/log_levels.d.ts.map +1 -0
  82. package/esm/{logLevels.js → log_levels.js} +1 -1
  83. package/esm/log_levels.js.map +1 -0
  84. package/{cjs/logStore.d.ts → esm/log_store.d.ts} +1 -1
  85. package/esm/log_store.d.ts.map +1 -0
  86. package/esm/{logStore.js → log_store.js} +2 -2
  87. package/esm/log_store.js.map +1 -0
  88. package/esm/logger.d.ts +1 -1
  89. package/esm/logger.d.ts.map +1 -1
  90. package/esm/logger.js +2 -2
  91. package/esm/logger.js.map +1 -1
  92. package/esm/memory.d.ts +2 -2
  93. package/esm/memory.d.ts.map +1 -1
  94. package/esm/memory.js +15 -8
  95. package/esm/memory.js.map +1 -1
  96. package/esm/platform.d.ts.map +1 -1
  97. package/esm/platform.js +1 -2
  98. package/esm/platform.js.map +1 -1
  99. package/esm/{standardLog.ctx.d.ts → standard_log.ctx.d.ts} +2 -2
  100. package/esm/standard_log.ctx.d.ts.map +1 -0
  101. package/esm/{standardLog.ctx.js → standard_log.ctx.js} +1 -1
  102. package/esm/standard_log.ctx.js.map +1 -0
  103. package/{cjs/standardLog.d.ts → esm/standard_log.d.ts} +4 -9
  104. package/esm/standard_log.d.ts.map +1 -0
  105. package/esm/{standardLog.js → standard_log.js} +27 -28
  106. package/esm/standard_log.js.map +1 -0
  107. package/esm/standard_log.mocks.d.ts +8 -0
  108. package/esm/standard_log.mocks.d.ts.map +1 -0
  109. package/esm/standard_log.mocks.js +16 -0
  110. package/esm/standard_log.mocks.js.map +1 -0
  111. package/esm/test_utils.d.ts +10 -0
  112. package/esm/test_utils.d.ts.map +1 -0
  113. package/esm/test_utils.js +18 -0
  114. package/esm/test_utils.js.map +1 -0
  115. package/esm/testing/index.d.ts +2 -0
  116. package/esm/testing/index.d.ts.map +1 -0
  117. package/esm/testing/index.js +2 -0
  118. package/esm/testing/index.js.map +1 -0
  119. package/esm/types.d.ts +12 -12
  120. package/esm/types.d.ts.map +1 -1
  121. package/esm/types.js.map +1 -1
  122. package/package.json +14 -8
  123. package/ts/console.ts +55 -46
  124. package/ts/errors.ts +6 -6
  125. package/ts/formatter.ts +19 -19
  126. package/ts/index.ts +19 -10
  127. package/ts/log_levels.ts +107 -0
  128. package/ts/log_store.ts +63 -0
  129. package/ts/logger.ts +69 -59
  130. package/ts/memory.ts +66 -54
  131. package/ts/platform.ts +2 -2
  132. package/ts/standard_log.ctx.ts +8 -0
  133. package/ts/standard_log.mocks.ts +22 -0
  134. package/ts/standard_log.ts +140 -0
  135. package/ts/test_utils.ts +21 -0
  136. package/ts/testing/index.ts +1 -0
  137. package/ts/types.ts +72 -62
  138. package/cjs/logLevels.d.ts.map +0 -1
  139. package/cjs/logLevels.js.map +0 -1
  140. package/cjs/logStore.d.ts.map +0 -1
  141. package/cjs/logStore.js.map +0 -1
  142. package/cjs/standardLog.ctx.d.ts.map +0 -1
  143. package/cjs/standardLog.ctx.js.map +0 -1
  144. package/cjs/standardLog.d.ts.map +0 -1
  145. package/cjs/standardLog.js.map +0 -1
  146. package/esm/logLevels.d.ts.map +0 -1
  147. package/esm/logLevels.js.map +0 -1
  148. package/esm/logStore.d.ts.map +0 -1
  149. package/esm/logStore.js.map +0 -1
  150. package/esm/standardLog.ctx.d.ts.map +0 -1
  151. package/esm/standardLog.ctx.js.map +0 -1
  152. package/esm/standardLog.d.ts.map +0 -1
  153. package/esm/standardLog.js.map +0 -1
  154. package/ts/logLevels.ts +0 -108
  155. package/ts/logStore.ts +0 -54
  156. package/ts/standardLog.ctx.ts +0 -8
  157. package/ts/standardLog.ts +0 -135
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../ts/logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,EAAyB,MAAM,EAAE,aAAa,EAAE,cAAc,EAAe,MAAM,YAAY,CAAA;AAG3G,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,GAAG,cAAc,EAC5D,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GACnD,MAAM,CAAC,CAAC,GAAG,cAAc,CAAC,CAwD5B"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../ts/logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,EAAyB,MAAM,EAAE,aAAa,EAAE,cAAc,EAAe,MAAM,YAAY,CAAA;AAG3G,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,GAAG,cAAc,EAC7D,KAAK,EAAE,QAAQ,EACf,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,aAAa,GACrB,MAAM,CAAC,CAAC,GAAG,cAAc,CAAC,CA4D5B"}
package/esm/logger.js CHANGED
@@ -1,4 +1,4 @@
1
- import { logLevels } from './logLevels.js';
1
+ import { logLevels } from './log_levels.js';
2
2
  export function createLogger(store, id, options) {
3
3
  var _a;
4
4
  id = sanitizeId(id);
@@ -21,7 +21,7 @@ export function createLogger(store, id, options) {
21
21
  id: { value: id, writable: false },
22
22
  count: {
23
23
  writable: false,
24
- value: ((counter) => (...args) => {
24
+ value: (counter => (...args) => {
25
25
  if (shouldLog(store, logLevels.debug, logger.level))
26
26
  write({
27
27
  id,
package/esm/logger.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../ts/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAK1C,MAAM,UAAU,YAAY,CAC1B,KAAe,EAAE,EAAU,EAAE,OAAuB;;IAEpD,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC,CAAA;IACnB,MAAM,OAAO,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,mCAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;IAChD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAqD,OAAO,OAA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C5B,OAAO,EAAE,CAAC,OAAO,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAA;AACtD,CAAC;AAED,SAAS,gBAAgB,CAAC,SAAwB,EAAE,QAAkB,EAAE,MAAuC;IAC7G,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAS,CAAC,CAAC,CAAA;AACtE,CAAC;AAED;;;;GAIG;AACH,SAAS,SAAS,CAAC,KAAe,EAAE,WAAqB,EAAE,WAAiC;IAC1F,OAAO,WAAW,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;AAClF,CAAC","sourcesContent":["import { logLevels } from './logLevels.js'\nimport { LogStore } from './logStore.js'\nimport type { LogEntry, LogFunction, Logger, LoggerOptions, LogMethodNames, LogReporter } from './types.js'\nimport { LogLevel } from './types.js'\n\nexport function createLogger<N extends string = LogMethodNames>(\n store: LogStore, id: string, options?: LoggerOptions\n): Logger<N | LogMethodNames> {\n id = sanitizeId(id)\n const writeTo = options?.writeTo ?? (() => true)\n const [filter, reporters]: [(reporterId: string) => boolean, LogReporter[]] = typeof writeTo === 'string'\n ? [id => id === writeTo, store.reporters]\n : writeTo instanceof RegExp\n ? [id => writeTo.test(id), store.reporters]\n : typeof writeTo === 'function'\n ? [writeTo, store.reporters]\n : [() => true, [writeTo]]\n\n function write(entry: LogEntry) {\n writeToReporters(reporters, entry, filter)\n }\n\n const logger = {\n level: options?.level,\n write\n } as any\n\n Object.defineProperties(logger, {\n id: { value: id, writable: false },\n count: {\n writable: false,\n value: ((counter) => (...args: any[]) => {\n if (shouldLog(store, logLevels.debug, logger.level))\n write({\n id,\n level: logLevels.debug,\n args: [++counter, ...args],\n timestamp: new Date()\n })\n })(0)\n },\n on: {\n writable: false,\n value: (level: number | N | LogMethodNames, logFn: LogFunction) => {\n const logLevel = typeof level === 'string' ? store.logLevelStore.getLevel(level)! : level\n if (shouldLog(store, logLevel, logger.level)) {\n const methodName = store.logLevelStore.getName(logLevel)\n const bindedMethod = logger[methodName].bind(logger)\n const result = logFn(bindedMethod, logger.level ?? store.logLevel)\n if (result) bindedMethod(result)\n }\n }\n }\n })\n store.logLevelStore.getAllLevels().forEach(function addMethod({ name, level }) {\n Object.defineProperty(logger, name, {\n writable: false,\n value: (...args: any[]) => {\n if (shouldLog(store, level, logger.level)) write({ id, level, args, timestamp: new Date() })\n }\n })\n })\n return logger\n}\n\nfunction sanitizeId(id: string) {\n return id.replace(/[`~!#$%^&*()=+[\\]{},|<>?]/g, '-')\n}\n\nfunction writeToReporters(reporters: LogReporter[], logEntry: LogEntry, filter: (reporterId: string) => boolean) {\n reporters.filter(r => filter(r.id)).forEach(r => r.write(logEntry!))\n}\n\n/**\n * Determines should you log.\n * @param loggerLevel Log level of the logger.\n * It can be undefined which the global log level will be used.\n */\nfunction shouldLog(store: LogStore, targetLevel: LogLevel, loggerLevel: LogLevel | undefined) {\n return targetLevel <= (loggerLevel !== undefined ? loggerLevel : store.logLevel)\n}\n"]}
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../ts/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAK3C,MAAM,UAAU,YAAY,CAC3B,KAAe,EACf,EAAU,EACV,OAAuB;;IAEvB,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC,CAAA;IACnB,MAAM,OAAO,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,mCAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;IAChD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GACxB,OAAO,OAAO,KAAK,QAAQ;QAC1B,CAAC,CAAC,CAAC,EAAE,CAAC,EA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AAA;AACrD,CAAC;AAED,SAAS,gBAAgB,CACxB,SAAwB,EACxB,QAAkB,EAClB,MAAuC;IAEvC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAS,CAAC,CAAC,CAAA;AACrE,CAAC;AAED;;;;GAIG;AACH,SAAS,SAAS,CAAC,KAAe,EAAE,WAAqB,EAAE,WAAiC;IAC3F,OAAO,WAAW,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;AACjF,CAAC","sourcesContent":["import { logLevels } from './log_levels.js'\nimport { LogStore } from './log_store.js'\nimport type { LogEntry, LogFunction, Logger, LoggerOptions, LogMethodNames, LogReporter } from './types.js'\nimport { LogLevel } from './types.js'\n\nexport function createLogger<N extends string = LogMethodNames>(\n\tstore: LogStore,\n\tid: string,\n\toptions?: LoggerOptions\n): Logger<N | LogMethodNames> {\n\tid = sanitizeId(id)\n\tconst writeTo = options?.writeTo ?? (() => true)\n\tconst [filter, reporters]: [(reporterId: string) => boolean, LogReporter[]] =\n\t\ttypeof writeTo === 'string'\n\t\t\t? [id => id === writeTo, store.reporters]\n\t\t\t: writeTo instanceof RegExp\n\t\t\t? [id => writeTo.test(id), store.reporters]\n\t\t\t: typeof writeTo === 'function'\n\t\t\t? [writeTo, store.reporters]\n\t\t\t: [() => true, [writeTo]]\n\n\tfunction write(entry: LogEntry) {\n\t\twriteToReporters(reporters, entry, filter)\n\t}\n\n\tconst logger = {\n\t\tlevel: options?.level,\n\t\twrite\n\t} as any\n\n\tObject.defineProperties(logger, {\n\t\tid: { value: id, writable: false },\n\t\tcount: {\n\t\t\twritable: false,\n\t\t\tvalue: (\n\t\t\t\tcounter =>\n\t\t\t\t(...args: any[]) => {\n\t\t\t\t\tif (shouldLog(store, logLevels.debug, logger.level))\n\t\t\t\t\t\twrite({\n\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\tlevel: logLevels.debug,\n\t\t\t\t\t\t\targs: [++counter, ...args],\n\t\t\t\t\t\t\ttimestamp: new Date()\n\t\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t)(0)\n\t\t},\n\t\ton: {\n\t\t\twritable: false,\n\t\t\tvalue: (level: number | N | LogMethodNames, logFn: LogFunction) => {\n\t\t\t\tconst logLevel = typeof level === 'string' ? store.logLevelStore.getLevel(level)! : level\n\t\t\t\tif (shouldLog(store, logLevel, logger.level)) {\n\t\t\t\t\tconst methodName = store.logLevelStore.getName(logLevel)\n\t\t\t\t\tconst bindedMethod = logger[methodName].bind(logger)\n\t\t\t\t\tconst result = logFn(bindedMethod, logger.level ?? store.logLevel)\n\t\t\t\t\tif (result) bindedMethod(result)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\tstore.logLevelStore.getAllLevels().forEach(function addMethod({ name, level }) {\n\t\tObject.defineProperty(logger, name, {\n\t\t\twritable: false,\n\t\t\tvalue: (...args: any[]) => {\n\t\t\t\tif (shouldLog(store, level, logger.level)) write({ id, level, args, timestamp: new Date() })\n\t\t\t}\n\t\t})\n\t})\n\treturn logger\n}\n\nfunction sanitizeId(id: string) {\n\treturn id.replace(/[`~!#$%^&*()=+[\\]{},|<>?]/g, '-')\n}\n\nfunction writeToReporters(\n\treporters: LogReporter[],\n\tlogEntry: LogEntry,\n\tfilter: (reporterId: string) => boolean\n) {\n\treporters.filter(r => filter(r.id)).forEach(r => r.write(logEntry!))\n}\n\n/**\n * Determines should you log.\n * @param loggerLevel Log level of the logger.\n * It can be undefined which the global log level will be used.\n */\nfunction shouldLog(store: LogStore, targetLevel: LogLevel, loggerLevel: LogLevel | undefined) {\n\treturn targetLevel <= (loggerLevel !== undefined ? loggerLevel : store.logLevel)\n}\n"]}
package/esm/memory.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { LogEntry, LogFormatter, LogReporter, LogReporterOptions } from './types.js';
2
- export declare type MemoryLogReporter = LogReporter<LogEntry> & {
2
+ export type MemoryLogReporter = LogReporter<LogEntry> & {
3
3
  logs: LogEntry[];
4
4
  /**
5
5
  * Gets a simple log message for testing.
@@ -11,7 +11,7 @@ export declare type MemoryLogReporter = LogReporter<LogEntry> & {
11
11
  getLogMessagesWithIdAndLevel(): string[];
12
12
  emit(): void;
13
13
  };
14
- export declare type MemoryLogFormatter = LogFormatter<LogEntry>;
14
+ export type MemoryLogFormatter = LogFormatter<LogEntry>;
15
15
  export declare function toMessageWithLevel(logs: LogEntry[]): string;
16
16
  export declare function createMemoryLogReporter(options?: LogReporterOptions<LogEntry>): MemoryLogReporter;
17
17
  export declare function createMemoryWithConsoleLogReporter(options?: LogReporterOptions<LogEntry>): MemoryLogReporter;
@@ -1 +1 @@
1
- {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../ts/memory.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAGzF,oBAAY,iBAAiB,GAAG,WAAW,CAAC,QAAQ,CAAC,GAAG;IACtD,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB;;;OAGG;IACH,aAAa,IAAI,MAAM,CAAC;IACxB,cAAc,IAAI,MAAM,EAAE,CAAC;IAC3B,sBAAsB,IAAI,MAAM,CAAC;IACjC,4BAA4B,IAAI,MAAM,EAAE,CAAC;IACzC,IAAI,IAAI,IAAI,CAAA;CACb,CAAA;AAED,oBAAY,kBAAkB,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAA;AAEvD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,EAAE,UAQlD;AAED,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GAAG,iBAAiB,CAEjG;AAoCD,wBAAgB,kCAAkC,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GAAG,iBAAiB,CAK5G"}
1
+ {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../ts/memory.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAGzF,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC,QAAQ,CAAC,GAAG;IACvD,IAAI,EAAE,QAAQ,EAAE,CAAA;IAChB;;;OAGG;IACH,aAAa,IAAI,MAAM,CAAA;IACvB,cAAc,IAAI,MAAM,EAAE,CAAA;IAC1B,sBAAsB,IAAI,MAAM,CAAA;IAChC,4BAA4B,IAAI,MAAM,EAAE,CAAA;IACxC,IAAI,IAAI,IAAI,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAA;AAEvD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,EAAE,UAWlD;AAED,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GAAG,iBAAiB,CAEjG;AA0CD,wBAAgB,kCAAkC,CACjD,OAAO,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GACpC,iBAAiB,CAMnB"}
package/esm/memory.js CHANGED
@@ -3,13 +3,14 @@ import { toInspectLogEntry } from './platform.js';
3
3
  import { formatLogLevel } from './formatter.js';
4
4
  import { createConsoleLogReporter } from './console.js';
5
5
  export function toMessageWithLevel(logs) {
6
- return logs.map(toInspectLogEntry)
6
+ return (logs
7
+ .map(toInspectLogEntry)
7
8
  .map(log => `${formatLogLevel(log.level)} ${log.args.join(' ')}`)
8
9
  .join('\n')
9
10
  // if it has more than this log,
10
11
  // we assume it is running under tests,
11
12
  // and remove this log to simplify testing.
12
- .replace(/^\(WARN\) already configured for test, ignoring config\(\) call\n/, '');
13
+ .replace(/^\(WARN\) already configured for test, ignoring config\(\) call\n/, ''));
13
14
  }
14
15
  export function createMemoryLogReporter(options) {
15
16
  return Object.freeze(buildMemoryReporter(unpartial({ id: 'memory' }, options)));
@@ -19,8 +20,12 @@ function buildMemoryReporter(options) {
19
20
  const logs = [];
20
21
  return {
21
22
  id,
22
- get formatter() { return formatter; },
23
- get filter() { return filter; },
23
+ get formatter() {
24
+ return formatter;
25
+ },
26
+ get filter() {
27
+ return filter;
28
+ },
24
29
  logs,
25
30
  write(entry) {
26
31
  if (filter && !filter(entry))
@@ -31,14 +36,16 @@ function buildMemoryReporter(options) {
31
36
  return this.getLogMessages().join('\n');
32
37
  },
33
38
  getLogMessages() {
34
- return logs.map(toInspectLogEntry)
35
- .map(log => log.args.join(' '));
39
+ return logs.map(toInspectLogEntry).map(log => log.args.join(' '));
36
40
  },
37
41
  getLogMessagesWithIdAndLevel() {
38
- return logs.map(toInspectLogEntry)
42
+ return logs
43
+ .map(toInspectLogEntry)
39
44
  .map(log => `${log.id} ${formatLogLevel(log.level)} ${log.args.join(' ')}`);
40
45
  },
41
- getLogMessageWithLevel() { return toMessageWithLevel(logs); },
46
+ getLogMessageWithLevel() {
47
+ return toMessageWithLevel(logs);
48
+ },
42
49
  /**
43
50
  * emit the saved log to console for easy debugging
44
51
  */
package/esm/memory.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"memory.js","sourceRoot":"","sources":["../ts/memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAA;AAiBvD,MAAM,UAAU,kBAAkB,CAAC,IAAgB;IACjD,OAAO,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAA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CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;QACnC,CAAC;QACD,4BAA4B;YAC1B,OAAO,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC;iBAC/B,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,EAAE,IAAI,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QAC/E,CAAC;QACD,sBAAsB,KAAK,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC;QAC5D;;WAEG;QACH,IAAI;YACF,MAAM,QAAQ,GAAG,wBAAwB,EAAE,CAAA;YAC3C,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;QACtC,CAAC;KACF,CAAA;AACH,CAAC;AAED,MAAM,UAAU,kCAAkC,CAAC,OAAsC;IACvF,OAAO,MAAM,CAAC,MAAM,CAClB,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,qBAAqB,EAAE,EAAE,OAAO,CAAC,CAAC,EAAE;QACpF,iBAAiB,EAAE,IAAI;KACxB,CAAC,CAAC,CAAA;AACP,CAAC","sourcesContent":["import { required, unpartial } from 'type-plus'\nimport { toInspectLogEntry } from './platform.js'\nimport { formatLogLevel } from './formatter.js'\nimport type { LogEntry, LogFormatter, LogReporter, LogReporterOptions } from './types.js'\nimport { createConsoleLogReporter } from './console.js'\n\nexport type MemoryLogReporter = LogReporter<LogEntry> & {\n logs: LogEntry[],\n /**\n * Gets a simple log message for testing.\n * The message only contains arguments for each log entry.\n */\n getLogMessage(): string,\n getLogMessages(): string[],\n getLogMessageWithLevel(): string,\n getLogMessagesWithIdAndLevel(): string[],\n emit(): void\n}\n\nexport type MemoryLogFormatter = LogFormatter<LogEntry>\n\nexport function toMessageWithLevel(logs: LogEntry[]) {\n return logs.map(toInspectLogEntry)\n .map(log => `${formatLogLevel(log.level)} ${log.args.join(' ')}`)\n .join('\\n')\n // if it has more than this log,\n // we assume it is running under tests,\n // and remove this log to simplify testing.\n .replace(/^\\(WARN\\) already configured for test, ignoring config\\(\\) call\\n/, '')\n}\n\nexport function createMemoryLogReporter(options?: LogReporterOptions<LogEntry>): MemoryLogReporter {\n return Object.freeze(buildMemoryReporter(unpartial({ id: 'memory' }, options)))\n}\n\nfunction buildMemoryReporter(options?: LogReporterOptions<LogEntry>) {\n const { id, formatter, filter } = required({ id: 'memory', formatter: (e: LogEntry) => e }, options)\n const logs: LogEntry[] = []\n return {\n id,\n get formatter() { return formatter },\n get filter() { return filter },\n logs,\n write(entry: LogEntry) {\n if (filter && !filter(entry)) return\n logs.push(formatter(entry))\n },\n getLogMessage() {\n return this.getLogMessages().join('\\n')\n },\n getLogMessages() {\n return logs.map(toInspectLogEntry)\n .map(log => log.args.join(' '))\n },\n getLogMessagesWithIdAndLevel() {\n return logs.map(toInspectLogEntry)\n .map(log => `${log.id} ${formatLogLevel(log.level)} ${log.args.join(' ')}`)\n },\n getLogMessageWithLevel() { return toMessageWithLevel(logs) },\n /**\n * emit the saved log to console for easy debugging\n */\n emit() {\n const reporter = createConsoleLogReporter()\n logs.forEach(l => reporter.write(l))\n }\n }\n}\n\nexport function createMemoryWithConsoleLogReporter(options?: LogReporterOptions<LogEntry>): MemoryLogReporter {\n return Object.freeze(\n Object.assign(buildMemoryReporter(unpartial({ id: 'memory-with-console' }, options)), {\n isConsoleReporter: true\n }))\n}\n"]}
1
+ {"version":3,"file":"memory.js","sourceRoot":"","sources":["../ts/memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,cAAc,EAA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,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACxC,CAAC;QACD,cAAc;YACb,OAAO,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;QAClE,CAAC;QACD,4BAA4B;YAC3B,OAAO,IAAI;iBACT,GAAG,CAAC,iBAAiB,CAAC;iBACtB,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,EAAE,IAAI,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QAC7E,CAAC;QACD,sBAAsB;YACrB,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAA;QAChC,CAAC;QACD;;WAEG;QACH,IAAI;YACH,MAAM,QAAQ,GAAG,wBAAwB,EAAE,CAAA;YAC3C,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;QACrC,CAAC;KACD,CAAA;AACF,CAAC;AAED,MAAM,UAAU,kCAAkC,CACjD,OAAsC;IAEtC,OAAO,MAAM,CAAC,MAAM,CACnB,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,qBAAqB,EAAE,EAAE,OAAO,CAAC,CAAC,EAAE;QACrF,iBAAiB,EAAE,IAAI;KACvB,CAAC,CACF,CAAA;AACF,CAAC","sourcesContent":["import { required, unpartial } from 'type-plus'\nimport { toInspectLogEntry } from './platform.js'\nimport { formatLogLevel } from './formatter.js'\nimport type { LogEntry, LogFormatter, LogReporter, LogReporterOptions } from './types.js'\nimport { createConsoleLogReporter } from './console.js'\n\nexport type MemoryLogReporter = LogReporter<LogEntry> & {\n\tlogs: LogEntry[]\n\t/**\n\t * Gets a simple log message for testing.\n\t * The message only contains arguments for each log entry.\n\t */\n\tgetLogMessage(): string\n\tgetLogMessages(): string[]\n\tgetLogMessageWithLevel(): string\n\tgetLogMessagesWithIdAndLevel(): string[]\n\temit(): void\n}\n\nexport type MemoryLogFormatter = LogFormatter<LogEntry>\n\nexport function toMessageWithLevel(logs: LogEntry[]) {\n\treturn (\n\t\tlogs\n\t\t\t.map(toInspectLogEntry)\n\t\t\t.map(log => `${formatLogLevel(log.level)} ${log.args.join(' ')}`)\n\t\t\t.join('\\n')\n\t\t\t// if it has more than this log,\n\t\t\t// we assume it is running under tests,\n\t\t\t// and remove this log to simplify testing.\n\t\t\t.replace(/^\\(WARN\\) already configured for test, ignoring config\\(\\) call\\n/, '')\n\t)\n}\n\nexport function createMemoryLogReporter(options?: LogReporterOptions<LogEntry>): MemoryLogReporter {\n\treturn Object.freeze(buildMemoryReporter(unpartial({ id: 'memory' }, options)))\n}\n\nfunction buildMemoryReporter(options?: LogReporterOptions<LogEntry>) {\n\tconst { id, formatter, filter } = required({ id: 'memory', formatter: (e: LogEntry) => e }, options)\n\tconst logs: LogEntry[] = []\n\treturn {\n\t\tid,\n\t\tget formatter() {\n\t\t\treturn formatter\n\t\t},\n\t\tget filter() {\n\t\t\treturn filter\n\t\t},\n\t\tlogs,\n\t\twrite(entry: LogEntry) {\n\t\t\tif (filter && !filter(entry)) return\n\t\t\tlogs.push(formatter(entry))\n\t\t},\n\t\tgetLogMessage() {\n\t\t\treturn this.getLogMessages().join('\\n')\n\t\t},\n\t\tgetLogMessages() {\n\t\t\treturn logs.map(toInspectLogEntry).map(log => log.args.join(' '))\n\t\t},\n\t\tgetLogMessagesWithIdAndLevel() {\n\t\t\treturn logs\n\t\t\t\t.map(toInspectLogEntry)\n\t\t\t\t.map(log => `${log.id} ${formatLogLevel(log.level)} ${log.args.join(' ')}`)\n\t\t},\n\t\tgetLogMessageWithLevel() {\n\t\t\treturn toMessageWithLevel(logs)\n\t\t},\n\t\t/**\n\t\t * emit the saved log to console for easy debugging\n\t\t */\n\t\temit() {\n\t\t\tconst reporter = createConsoleLogReporter()\n\t\t\tlogs.forEach(l => reporter.write(l))\n\t\t}\n\t}\n}\n\nexport function createMemoryWithConsoleLogReporter(\n\toptions?: LogReporterOptions<LogEntry>\n): MemoryLogReporter {\n\treturn Object.freeze(\n\t\tObject.assign(buildMemoryReporter(unpartial({ id: 'memory-with-console' }, options)), {\n\t\t\tisConsoleReporter: true\n\t\t})\n\t)\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../ts/platform.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAEvD,eAAO,MAAM,iBAAiB,MAAO,QAAQ,aAEzC,CAAA;AAEJ,eAAO,MAAM,QAAQ,EAAE;IAAE,OAAO,CAAC,EAAE,WAAW,CAAA;CAAa,CAAA"}
1
+ {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../ts/platform.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAEvD,eAAO,MAAM,iBAAiB,MAAO,QAAQ,aAE5C,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE;IAAE,OAAO,CAAC,EAAE,WAAW,CAAA;CAAa,CAAA"}
package/esm/platform.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { record } from 'type-plus';
2
2
  import { inspect } from 'util';
3
- export const toInspectLogEntry = (e) => (e.args = e.args.map(value => typeof value === 'object' && value !== null ? inspect(value) : value),
4
- e);
3
+ export const toInspectLogEntry = (e) => ((e.args = e.args.map(value => (typeof value === 'object' && value !== null ? inspect(value) : value))), e);
5
4
  export const polyfill = record();
6
5
  //# sourceMappingURL=platform.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"platform.js","sourceRoot":"","sources":["../ts/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAG9B,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAW,EAAE,EAAE,CAAC,CAChD,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAClG,CAAC,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,QAAQ,GAA8B,MAAM,EAAE,CAAA","sourcesContent":["import { record } from 'type-plus'\nimport { inspect } from 'util'\nimport type { ConsoleLike, LogEntry } from './types.js'\n\nexport const toInspectLogEntry = (e: LogEntry) => (\n e.args = e.args.map(value => typeof value === 'object' && value !== null ? inspect(value) : value),\n e)\n\nexport const polyfill: { console?: ConsoleLike } = record()\n"]}
1
+ {"version":3,"file":"platform.js","sourceRoot":"","sources":["../ts/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAG9B,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAW,EAAE,EAAE,CAAC,CACjD,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CACzG,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAA8B,MAAM,EAAE,CAAA","sourcesContent":["import { record } from 'type-plus'\nimport { inspect } from 'util'\nimport type { ConsoleLike, LogEntry } from './types.js'\n\nexport const toInspectLogEntry = (e: LogEntry) => (\n\t(e.args = e.args.map(value => (typeof value === 'object' && value !== null ? inspect(value) : value))), e\n)\n\nexport const polyfill: { console?: ConsoleLike } = record()\n"]}
@@ -1,4 +1,4 @@
1
- import type { LogStore } from './logStore.js';
1
+ import type { LogStore } from './log_store.js';
2
2
  import type { LogMethodNames, StandardLogInstance } from './types.js';
3
3
  export declare const ctx: {
4
4
  configured?: boolean;
@@ -7,4 +7,4 @@ export declare const ctx: {
7
7
  standardLog: StandardLogInstance<LogMethodNames>;
8
8
  };
9
9
  };
10
- //# sourceMappingURL=standardLog.ctx.d.ts.map
10
+ //# sourceMappingURL=standard_log.ctx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standard_log.ctx.d.ts","sourceRoot":"","sources":["../ts/standard_log.ctx.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAErE,eAAO,MAAM,GAAG,EAAE;IACjB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,GAAG,CAAC,EAAE;QAAE,KAAK,EAAE,QAAQ,CAAC;QAAC,WAAW,EAAE,mBAAmB,CAAC,cAAc,CAAC,CAAA;KAAE,CAAA;CAChE,CAAA"}
@@ -1,3 +1,3 @@
1
1
  import { record } from 'type-plus';
2
2
  export const ctx = record();
3
- //# sourceMappingURL=standardLog.ctx.js.map
3
+ //# sourceMappingURL=standard_log.ctx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standard_log.ctx.js","sourceRoot":"","sources":["../ts/standard_log.ctx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAIlC,MAAM,CAAC,MAAM,GAAG,GAGZ,MAAM,EAAE,CAAA","sourcesContent":["import { record } from 'type-plus'\nimport type { LogStore } from './log_store.js'\nimport type { LogMethodNames, StandardLogInstance } from './types.js'\n\nexport const ctx: {\n\tconfigured?: boolean\n\tgsl?: { store: LogStore; standardLog: StandardLogInstance<LogMethodNames> }\n} = record()\n"]}
@@ -1,6 +1,5 @@
1
- import { LogStore } from './logStore.js';
2
- import { MemoryLogReporter } from './memory.js';
3
- import type { Logger, LoggerOptions, LogLevel, LogMethodNames, StandardLogInstance, StandardLogOptions } from './types.js';
1
+ import { type LogStore } from './log_store.js';
2
+ import type { LogMethodNames, Logger, LoggerOptions, StandardLogInstance, StandardLogOptions } from './types.js';
4
3
  export interface StandardLog<N extends string = LogMethodNames> extends Readonly<StandardLogInstance<N>> {
5
4
  }
6
5
  export declare function createStandardLog<N extends string = LogMethodNames>(options?: StandardLogOptions<N>): StandardLog<N>;
@@ -8,15 +7,11 @@ export declare function createStandardLogClosure<N extends string = LogMethodNam
8
7
  store: LogStore;
9
8
  standardLog: StandardLog<N>;
10
9
  };
11
- export declare type StandardLogForTest<N extends string = LogMethodNames> = StandardLog<N> & {
12
- reporter: MemoryLogReporter;
13
- };
14
- export declare function createStandardLogForTest<N extends string = LogMethodNames>(logLevel?: LogLevel): StandardLogForTest<N>;
15
10
  /**
16
11
  * Suppress logging within the code block.
17
12
  */
18
13
  export declare function suppressLogs<R>(block: () => R, log: Logger, ...logs: Logger[]): R;
19
- export declare type GetLogger<N extends string = LogMethodNames> = (id: string, options?: LoggerOptions) => Logger<LogMethodNames | N>;
14
+ export type GetLogger<N extends string = LogMethodNames> = (id: string, options?: LoggerOptions) => Logger<LogMethodNames | N>;
20
15
  export declare function getLogger<N extends string = LogMethodNames>(id: string, options?: LoggerOptions): Logger<LogMethodNames | N>;
21
16
  export declare function configGlobal(options: Omit<StandardLogOptions, 'customLevels'>): void;
22
- //# sourceMappingURL=standardLog.d.ts.map
17
+ //# sourceMappingURL=standard_log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"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@@ -1,9 +1,8 @@
1
1
  import { record, required } from 'type-plus';
2
+ import { DEFAULT_LOG_METHOD_NAMES, logLevels } from './log_levels.js';
3
+ import { createLogStore } from './log_store.js';
2
4
  import { createLogger } from './logger.js';
3
- import { DEFAULT_LOG_METHOD_NAMES, logLevels } from './logLevels.js';
4
- import { createLogStore } from './logStore.js';
5
- import { createMemoryLogReporter } from './memory.js';
6
- import { ctx } from './standardLog.ctx.js';
5
+ import { ctx } from './standard_log.ctx.js';
7
6
  export function createStandardLog(options) {
8
7
  var _a;
9
8
  const closure = createStandardLogClosure(options);
@@ -21,13 +20,17 @@ export function createStandardLogClosure(options) {
21
20
  // TODO reporter.id must not be empty
22
21
  const store = createLogStore(required({ logLevel: logLevels.info }, options));
23
22
  const nonConsoleReporters = (_b = (_a = options === null || options === void 0 ? void 0 : options.reporters) === null || _a === void 0 ? void 0 : _a.filter(r => !r.isConsoleReporter).map(r => r.id)) !== null && _b !== void 0 ? _b : [];
24
- const logMethods = DEFAULT_LOG_METHOD_NAMES
25
- .concat(Object.keys((_c = options === null || options === void 0 ? void 0 : options.customLevels) !== null && _c !== void 0 ? _c : {}))
26
- .concat(['on', 'count', 'write']);
23
+ const logMethods = DEFAULT_LOG_METHOD_NAMES.concat(Object.keys((_c = options === null || options === void 0 ? void 0 : options.customLevels) !== null && _c !== void 0 ? _c : {})).concat([
24
+ 'on',
25
+ 'count',
26
+ 'write'
27
+ ]);
27
28
  return {
28
29
  store,
29
30
  standardLog: {
30
- get logLevel() { return store.logLevel; },
31
+ get logLevel() {
32
+ return store.logLevel;
33
+ },
31
34
  toLogLevelName(level) {
32
35
  return store.logLevelStore.getName(level);
33
36
  },
@@ -37,7 +40,7 @@ export function createStandardLogClosure(options) {
37
40
  getLogger(id, options) {
38
41
  if (store.loggers[id])
39
42
  return store.loggers[id];
40
- return store.loggers[id] = createLogger(store, id, { ssf: this.getLogger, ...options });
43
+ return (store.loggers[id] = createLogger(store, id, { ssf: this.getLogger, ...options }));
41
44
  },
42
45
  getNonConsoleLogger(id, options) {
43
46
  if (store.nonConsoleLoggers[id])
@@ -45,18 +48,19 @@ export function createStandardLogClosure(options) {
45
48
  if (store.loggers[id]) {
46
49
  const log = this.getLogger('standard-log');
47
50
  log.warn(`attempt to create a non-console logger with existing id ('${id}'), ignoring`);
48
- return store.nonConsoleLoggers[id] = createDummyLogger(logMethods);
51
+ return (store.nonConsoleLoggers[id] = createDummyLogger(logMethods));
49
52
  }
50
- return store.nonConsoleLoggers[id] = nonConsoleReporters.length === 0
51
- ? createDummyLogger(logMethods)
52
- : createLogger(store, id, {
53
- ssf: this.getNonConsoleLogger,
54
- ...options,
55
- writeTo(reporterId) {
56
- return nonConsoleReporters.indexOf(reporterId) >= 0;
57
- }
58
- });
59
- },
53
+ return (store.nonConsoleLoggers[id] =
54
+ nonConsoleReporters.length === 0
55
+ ? createDummyLogger(logMethods)
56
+ : createLogger(store, id, {
57
+ ssf: this.getNonConsoleLogger,
58
+ ...options,
59
+ writeTo(reporterId) {
60
+ return nonConsoleReporters.indexOf(reporterId) >= 0;
61
+ }
62
+ }));
63
+ }
60
64
  }
61
65
  };
62
66
  }
@@ -66,16 +70,11 @@ function createDummyLogger(logMethods) {
66
70
  return p;
67
71
  }, record());
68
72
  }
69
- export function createStandardLogForTest(logLevel = logLevels.debug) {
70
- const reporter = createMemoryLogReporter();
71
- const closure = createStandardLogClosure({ reporters: [reporter], logLevel });
72
- return { ...closure.standardLog, reporter };
73
- }
74
73
  export function suppressLogs(block, ...logs) {
75
74
  const origLevels = logs.map(l => l.level);
76
- logs.forEach(l => l.level = logLevels.none);
75
+ logs.forEach(l => (l.level = logLevels.none));
77
76
  const result = block();
78
- logs.forEach((l, i) => l.level = origLevels[i]);
77
+ logs.forEach((l, i) => (l.level = origLevels[i]));
79
78
  return result;
80
79
  }
81
80
  export function getLogger(id, options) {
@@ -106,4 +105,4 @@ export function configGlobal(options) {
106
105
  }
107
106
  ctx.configured = true;
108
107
  }
109
- //# sourceMappingUR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els } from './log_levels.js'\nimport { createLogStore, type LogStore } from './log_store.js'\nimport { createLogger } from './logger.js'\nimport { ctx } from './standard_log.ctx.js'\nimport type {\n\tLogMethodNames,\n\tLogger,\n\tLoggerOptions,\n\tStandardLogInstance,\n\tStandardLogOptions\n} from './types.js'\n\nexport interface StandardLog<N extends string = LogMethodNames> extends Readonly<StandardLogInstance<N>> {}\n\nexport function createStandardLog<N extends string = LogMethodNames>(\n\toptions?: StandardLogOptions<N>\n): StandardLog<N> {\n\tconst closure = createStandardLogClosure(options)\n\tif (options?.reporters?.some(r => !r.id)) {\n\t\tconst log = closure.standardLog.getLogger('standard-log')\n\t\tlog.critical(\n\t\t\t`Detected reporter with empty id. This is not allowed as it will create problems with feature like 'getNonConsoleLogger()'. Please add an id to your reporter.`\n\t\t)\n\t}\n\n\tif (!ctx.gsl) ctx.gsl = closure as any\n\treturn closure.standardLog\n}\n\nfunction noop() {}\n\nexport function createStandardLogClosure<N extends string = LogMethodNames>(\n\toptions?: StandardLogOptions<N>\n): { store: LogStore; standardLog: StandardLog<N> } {\n\t// TODO reporter.id must not be empty\n\tconst store = createLogStore(required({ logLevel: logLevels.info }, options))\n\tconst nonConsoleReporters = options?.reporters?.filter(r => !r.isConsoleReporter).map(r => r.id) ?? []\n\tconst logMethods = DEFAULT_LOG_METHOD_NAMES.concat(Object.keys(options?.customLevels ?? {})).concat([\n\t\t'on',\n\t\t'count',\n\t\t'write'\n\t])\n\treturn {\n\t\tstore,\n\t\tstandardLog: {\n\t\t\tget logLevel() {\n\t\t\t\treturn store.logLevel\n\t\t\t},\n\n\t\t\ttoLogLevelName(level: number) {\n\t\t\t\treturn store.logLevelStore.getName(level)\n\t\t\t},\n\t\t\ttoLogLevel(name: string) {\n\t\t\t\treturn store.logLevelStore.getLevel(name)\n\t\t\t},\n\t\t\tgetLogger(id: string, options?: LoggerOptions) {\n\t\t\t\tif (store.loggers[id]) return store.loggers[id] as any\n\t\t\t\treturn (store.loggers[id] = createLogger(store, id, { ssf: this.getLogger, ...options }) as any)\n\t\t\t},\n\t\t\tgetNonConsoleLogger(id, options?) {\n\t\t\t\tif (store.nonConsoleLoggers[id]) return store.nonConsoleLoggers[id] as any\n\n\t\t\t\tif (store.loggers[id]) {\n\t\t\t\t\tconst log = this.getLogger('standard-log')\n\t\t\t\t\tlog.warn(`attempt to create a non-console logger with existing id ('${id}'), ignoring`)\n\t\t\t\t\treturn (store.nonConsoleLoggers[id] = createDummyLogger(logMethods))\n\t\t\t\t}\n\n\t\t\t\treturn (store.nonConsoleLoggers[id] =\n\t\t\t\t\tnonConsoleReporters.length === 0\n\t\t\t\t\t\t? createDummyLogger(logMethods)\n\t\t\t\t\t\t: createLogger(store, id, {\n\t\t\t\t\t\t\t\tssf: this.getNonConsoleLogger,\n\t\t\t\t\t\t\t\t...options,\n\t\t\t\t\t\t\t\twriteTo(reporterId) {\n\t\t\t\t\t\t\t\t\treturn nonConsoleReporters.indexOf(reporterId) >= 0\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t }))\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction createDummyLogger(logMethods: string[]) {\n\treturn logMethods.reduce((p, m) => {\n\t\tp[m] = noop\n\t\treturn p\n\t}, record()) as Logger\n}\n\n/**\n * Suppress logging within the code block.\n */\nexport function suppressLogs<R>(block: () => R, log: Logger, ...logs: Logger[]): R\nexport function suppressLogs<R>(block: () => R, ...logs: Logger[]): R {\n\tconst origLevels = logs.map(l => l.level)\n\tlogs.forEach(l => (l.level = logLevels.none))\n\tconst result = block()\n\tlogs.forEach((l, i) => (l.level = origLevels[i]))\n\treturn result\n}\n\nexport type GetLogger<N extends string = LogMethodNames> = (\n\tid: string,\n\toptions?: LoggerOptions\n) => Logger<LogMethodNames | N>\n\nexport function getLogger<N extends string = LogMethodNames>(id: string, options?: LoggerOptions) {\n\treturn getGlobalSL<N>().getLogger(id, options)\n}\n\nfunction getGlobalSL<N extends string = LogMethodNames>(): StandardLogInstance<N> {\n\tif (!ctx.gsl) ctx.gsl = createStandardLogClosure()\n\n\treturn ctx.gsl!.standardLog as StandardLogInstance<N>\n}\n\nexport function configGlobal(options: Omit<StandardLogOptions, 'customLevels'>) {\n\tif (ctx.configured) {\n\t\tconst log = ctx.gsl!.standardLog.getLogger('standard-log')\n\t\tlog.warn(\n\t\t\t'configGlobal() is being called more than once. Please make sure this is expected. Application should use `createStandardLog()` most of the time.'\n\t\t)\n\t}\n\n\tif (ctx.gsl) {\n\t\tif (options.logLevel) {\n\t\t\tctx.gsl.store.logLevel = options.logLevel\n\t\t}\n\t\tif (options.reporters) {\n\t\t\tconst reporters = ctx.gsl.store.reporters\n\t\t\treporters.length = 0\n\t\t\treporters.push(...options.reporters)\n\t\t}\n\t} else {\n\t\tctx.gsl = createStandardLogClosure(options)\n\t}\n\tctx.configured = true\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import { type MemoryLogReporter } from './memory.js';
2
+ import { type StandardLog } from './standard_log.js';
3
+ import type { LogMethodNames, StandardLogOptions } from './types.js';
4
+ export type StandardLogForTest<N extends string = LogMethodNames> = StandardLog<N> & {
5
+ reporter: MemoryLogReporter;
6
+ };
7
+ export declare function createStandardLogForTest<N extends string = LogMethodNames>(options?: StandardLogOptions<N>): StandardLogForTest<N>;
8
+ //# sourceMappingURL=standard_log.mocks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standard_log.mocks.d.ts","sourceRoot":"","sources":["../ts/standard_log.mocks.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC7E,OAAO,EAA4B,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAEpE,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,GAAG,cAAc,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG;IACpF,QAAQ,EAAE,iBAAiB,CAAA;CAC3B,CAAA;AAED,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,MAAM,GAAG,cAAc,EACzE,OAAO,GAAE,kBAAkB,CAAC,CAAC,CAAM,GACjC,kBAAkB,CAAC,CAAC,CAAC,CAUvB"}
@@ -0,0 +1,16 @@
1
+ import { logLevels } from './log_levels.js';
2
+ import { createMemoryLogReporter } from './memory.js';
3
+ import { createStandardLogClosure } from './standard_log.js';
4
+ export function createStandardLogForTest(options = {}) {
5
+ var _a, _b;
6
+ options.logLevel = (_a = options.logLevel) !== null && _a !== void 0 ? _a : logLevels.debug;
7
+ options.reporters = (_b = options.reporters) !== null && _b !== void 0 ? _b : [];
8
+ const existingReporter = options.reporters.find(r => r.id === 'memory');
9
+ const reporter = existingReporter !== null && existingReporter !== void 0 ? existingReporter : createMemoryLogReporter();
10
+ if (!existingReporter) {
11
+ options.reporters.push(reporter);
12
+ }
13
+ const closure = createStandardLogClosure(options);
14
+ return { ...closure.standardLog, reporter };
15
+ }
16
+ //# sourceMappingURL=standard_log.mocks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standard_log.mocks.js","sourceRoot":"","sources":["../ts/standard_log.mocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,uBAAuB,EAA0B,MAAM,aAAa,CAAA;AAC7E,OAAO,EAAE,wBAAwB,EAAoB,MAAM,mBAAmB,CAAA;AAO9E,MAAM,UAAU,wBAAwB,CACvC,UAAiC,EAAE;;IAEnC,OAAO,CAAC,QAAQ,GAAG,MAAA,OAAO,CAAC,QAAQ,mCAAI,SAAS,CAAC,KAAK,CAAA;IACtD,OAAO,CAAC,SAAS,GAAG,MAAA,OAAO,CAAC,SAAS,mCAAI,EAAE,CAAA;IAC3C,MAAM,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAsB,CAAA;IAC5F,MAAM,QAAQ,GAAG,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,uBAAuB,EAAE,CAAA;IAC9D,IAAI,CAAC,gBAAgB,EAAE;QACtB,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;KAChC;IACD,MAAM,OAAO,GAAG,wBAAwB,CAAI,OAAO,CAAC,CAAA;IACpD,OAAO,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE,QAAQ,EAAE,CAAA;AAC5C,CAAC","sourcesContent":["import { logLevels } from './log_levels.js'\nimport { createMemoryLogReporter, type MemoryLogReporter } from './memory.js'\nimport { createStandardLogClosure, type StandardLog } from './standard_log.js'\nimport type { LogMethodNames, StandardLogOptions } from './types.js'\n\nexport type StandardLogForTest<N extends string = LogMethodNames> = StandardLog<N> & {\n\treporter: MemoryLogReporter\n}\n\nexport function createStandardLogForTest<N extends string = LogMethodNames>(\n\toptions: StandardLogOptions<N> = {}\n): StandardLogForTest<N> {\n\toptions.logLevel = options.logLevel ?? logLevels.debug\n\toptions.reporters = options.reporters ?? []\n\tconst existingReporter = options.reporters.find(r => r.id === 'memory') as MemoryLogReporter\n\tconst reporter = existingReporter ?? createMemoryLogReporter()\n\tif (!existingReporter) {\n\t\toptions.reporters.push(reporter)\n\t}\n\tconst closure = createStandardLogClosure<N>(options)\n\treturn { ...closure.standardLog, reporter }\n}\n"]}
@@ -0,0 +1,10 @@
1
+ /// <reference types="jest" />
2
+ import type { LogEntry } from './types.js';
3
+ export declare function rangeEntries(start: number, end: number, expected: any): any[][];
4
+ export declare function assertSSF(err: Error, filename: string): void;
5
+ export declare function logEntriesToString(logs: LogEntry[]): string;
6
+ export declare function wrapTest<F extends Record<any, any>>(fn: (test: jest.It) => F): F & {
7
+ only: F;
8
+ skip: F;
9
+ };
10
+ //# sourceMappingURL=test_utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test_utils.d.ts","sourceRoot":"","sources":["../ts/test_utils.ts"],"names":[],"mappings":";AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAE1C,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,WAErE;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,QAGrD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,EAAE,UAElD;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC;;;EAE5E"}
@@ -0,0 +1,18 @@
1
+ import { range } from 'ramda';
2
+ import { plainLogFormatter } from './formatter.js';
3
+ import { toInspectLogEntry } from './platform.js';
4
+ export function rangeEntries(start, end, expected) {
5
+ return range(start, end).map(value => [value, expected]);
6
+ }
7
+ export function assertSSF(err, filename) {
8
+ var _a;
9
+ const firstStackTrace = (_a = err.stack) === null || _a === void 0 ? void 0 : _a.split('\n')[1];
10
+ expect(firstStackTrace).toMatch(filename);
11
+ }
12
+ export function logEntriesToString(logs) {
13
+ return logs.map(toInspectLogEntry).map(plainLogFormatter).join('\n');
14
+ }
15
+ export function wrapTest(fn) {
16
+ return Object.assign(fn(test), { only: fn(test.only), skip: fn(test.skip) });
17
+ }
18
+ //# sourceMappingURL=test_utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test_utils.js","sourceRoot":"","sources":["../ts/test_utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAGjD,MAAM,UAAU,YAAY,CAAC,KAAa,EAAE,GAAW,EAAE,QAAa;IACrE,OAAO,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAA;AACzD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,GAAU,EAAE,QAAgB;;IACrD,MAAM,eAAe,GAAG,MAAA,GAAG,CAAC,KAAK,0CAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;IACjD,MAAM,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;AAC1C,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAAgB;IAClD,OAAO,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACrE,CAAC;AAED,MAAM,UAAU,QAAQ,CAA6B,EAAwB;IAC5E,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAC7E,CAAC","sourcesContent":["import { range } from 'ramda'\nimport { plainLogFormatter } from './formatter.js'\nimport { toInspectLogEntry } from './platform.js'\nimport type { LogEntry } from './types.js'\n\nexport function rangeEntries(start: number, end: number, expected: any) {\n\treturn range(start, end).map(value => [value, expected])\n}\n\nexport function assertSSF(err: Error, filename: string) {\n\tconst firstStackTrace = err.stack?.split('\\n')[1]\n\texpect(firstStackTrace).toMatch(filename)\n}\n\nexport function logEntriesToString(logs: LogEntry[]) {\n\treturn logs.map(toInspectLogEntry).map(plainLogFormatter).join('\\n')\n}\n\nexport function wrapTest<F extends Record<any, any>>(fn: (test: jest.It) => F) {\n\treturn Object.assign(fn(test), { only: fn(test.only), skip: fn(test.skip) })\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export { createStandardLogForTest, type StandardLogForTest } from '../standard_log.mocks.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,KAAK,kBAAkB,EAAE,MAAM,0BAA0B,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { createStandardLogForTest } from '../standard_log.mocks.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAA2B,MAAM,0BAA0B,CAAA","sourcesContent":["export { createStandardLogForTest, type StandardLogForTest } from '../standard_log.mocks.js'\n"]}
package/esm/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { StackTraceMeta } from '@just-func/types';
2
- export declare type StandardLogOptions<CustomLevelNames extends string = LogMethodNames> = {
2
+ export type StandardLogOptions<CustomLevelNames extends string = LogMethodNames> = {
3
3
  customLevels?: Record<CustomLevelNames, number>;
4
4
  logLevel?: number;
5
5
  reporters?: LogReporter[];
@@ -8,7 +8,7 @@ export interface LoggerOptions extends StackTraceMeta {
8
8
  level?: number;
9
9
  writeTo?: LogReporter | ReporterFilter;
10
10
  }
11
- export declare type Logger<N extends string = LogMethodNames> = {
11
+ export type Logger<N extends string = LogMethodNames> = {
12
12
  readonly id: string;
13
13
  /**
14
14
  * Logger local log level.
@@ -30,16 +30,16 @@ export declare type Logger<N extends string = LogMethodNames> = {
30
30
  /**
31
31
  * Names of the standard log methods.
32
32
  */
33
- export declare type LogMethodNames = 'emergency' | 'alert' | 'critical' | 'error' | 'warn' | 'notice' | 'info' | 'debug' | 'trace' | 'planck';
34
- export declare type LogEntry = {
33
+ export type LogMethodNames = 'emergency' | 'alert' | 'critical' | 'error' | 'warn' | 'notice' | 'info' | 'debug' | 'trace' | 'planck';
34
+ export type LogEntry = {
35
35
  id: string;
36
36
  level: number;
37
37
  args: any[];
38
38
  timestamp: Date;
39
39
  };
40
- export declare type LogMethod = (...args: any[]) => void;
41
- export declare type LogFunction = (log: LogMethod, logLevel: number) => string | void;
42
- export declare type ReporterFilter = string | RegExp | ((reporterId: string) => boolean);
40
+ export type LogMethod = (...args: any[]) => void;
41
+ export type LogFunction = (log: LogMethod, logLevel: number) => string | void;
42
+ export type ReporterFilter = string | RegExp | ((reporterId: string) => boolean);
43
43
  export interface StandardLogInstance<N extends string = LogMethodNames> {
44
44
  logLevel: number;
45
45
  toLogLevelName(level: number): string;
@@ -52,12 +52,12 @@ export interface StandardLogInstance<N extends string = LogMethodNames> {
52
52
  * Depends on the reporter, it can expect a different return type.
53
53
  * By default the return type is `any[]` which the `console` accepts.
54
54
  */
55
- export declare type LogFormatter<T = any[]> = (entry: LogEntry) => T;
55
+ export type LogFormatter<T = any[]> = (entry: LogEntry) => T;
56
56
  /**
57
57
  * Determines whether the entry should be written.
58
58
  */
59
- export declare type LogFilter = (entry: LogEntry) => boolean;
60
- export declare type LogLevelEntry = {
59
+ export type LogFilter = (entry: LogEntry) => boolean;
60
+ export type LogLevelEntry = {
61
61
  name: string;
62
62
  level: number;
63
63
  };
@@ -79,7 +79,7 @@ export interface LogReporter<T = any> {
79
79
  readonly isConsoleReporter?: boolean;
80
80
  write(entry: LogEntry): void;
81
81
  }
82
- export declare type LogReporterOptions<T = any> = {
82
+ export type LogReporterOptions<T = any> = {
83
83
  id?: string;
84
84
  /**
85
85
  * Specifies the formatter to be used by the reporter.
@@ -91,7 +91,7 @@ export declare type LogReporterOptions<T = any> = {
91
91
  */
92
92
  filter?: LogFilter;
93
93
  };
94
- export declare type LogLevel = number;
94
+ export type LogLevel = number;
95
95
  export interface ConsoleLike {
96
96
  debug(...args: any[]): void;
97
97
  info(...args: any[]): void;
@@ -1 +1 @@
1
- {"version":3,"file":"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AE,GAAG,EAAE,GAAG,IAAI,CAAA;IAC3B,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;IAC1B,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;IAC1B,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;CAC3B"}
package/esm/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../ts/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { StackTraceMeta } from '@just-func/types'\n\nexport type StandardLogOptions<CustomLevelNames extends string = LogMethodNames> = {\n customLevels?: Record<CustomLevelNames, number>,\n logLevel?: number,\n reporters?: LogReporter[]\n}\n\nexport interface LoggerOptions extends StackTraceMeta {\n level?: number,\n writeTo?: LogReporter | ReporterFilter\n}\n\nexport type Logger<N extends string = LogMethodNames> = {\n readonly id: string,\n /**\n * Logger local log level.\n */\n level?: number,\n /**\n * Logs with an increment counter.\n * This is useful during debugging to check for steps executed.\n */\n count(...args: any[]): void,\n on(level: number | N, logFunction: LogFunction): void,\n /**\n * Write custom log entries.\n */\n write(entry: LogEntry): void\n} & { [k in N]: LogMethod }\n\n/**\n * Names of the standard log methods.\n */\nexport type LogMethodNames = 'emergency' | 'alert' | 'critical' | 'error' | 'warn' | 'notice' | 'info' | 'debug' | 'trace' | 'planck'\n\nexport type LogEntry = {\n id: string,\n level: number,\n // args instead of messages because it is `any[]` instead of `string[]`\n args: any[],\n timestamp: Date\n}\n\nexport type LogMethod = (...args: any[]) => void\n\nexport type LogFunction = (log: LogMethod, logLevel: number) => string | void\n\nexport type ReporterFilter = string | RegExp | ((reporterId: string) => boolean)\n\nexport interface StandardLogInstance<N extends string = LogMethodNames> {\n logLevel: number,\n toLogLevelName(level: number): string,\n toLogLevel(name: N): number,\n getLogger(id: string, options?: LoggerOptions): Logger<N | LogMethodNames>,\n getNonConsoleLogger(id: string, options?: LoggerOptions): Logger<N | LogMethodNames>\n}\n\n/**\n * Formats a log entry.\n * Depends on the reporter, it can expect a different return type.\n * By default the return type is `any[]` which the `console` accepts.\n */\nexport type LogFormatter<T = any[]> = (entry: LogEntry) => T\n\n/**\n * Determines whether the entry should be written.\n */\nexport type LogFilter = (entry: LogEntry) => boolean\n\nexport type LogLevelEntry = { name: string, level: number }\n\nexport interface LogReporter<T = any> {\n readonly id: string,\n /**\n * Specifies the formatter to be used by the reporter.\n * Using this you can customize how the reporter writes the log entry.\n */\n readonly formatter: LogFormatter<T>,\n /**\n * Specifies a filter to determine should the log be written.\n */\n readonly filter?: LogFilter,\n /**\n * Indicate if this is a console reporter.\n * There is only one console reporter can be present in the system.\n */\n readonly isConsoleReporter?: boolean,\n write(entry: LogEntry): void\n}\n\nexport type LogReporterOptions<T = any> = {\n id?: string,\n /**\n * Specifies the formatter to be used by the reporter.\n * Using this you can customize how the reporter writes the log entry.\n */\n formatter?: LogFormatter<T>,\n /**\n * Specifies a filter to determine should the log be written.\n */\n filter?: LogFilter\n}\n\nexport type LogLevel = number\n\nexport interface ConsoleLike {\n debug(...args: any[]): void,\n info(...args: any[]): void,\n warn(...args: any[]): void,\n error(...args: any[]): void,\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../ts/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { StackTraceMeta } from '@just-func/types'\n\nexport type StandardLogOptions<CustomLevelNames extends string = LogMethodNames> = {\n\tcustomLevels?: Record<CustomLevelNames, number>\n\tlogLevel?: number\n\treporters?: LogReporter[]\n}\n\nexport interface LoggerOptions extends StackTraceMeta {\n\tlevel?: number\n\twriteTo?: LogReporter | ReporterFilter\n}\n\nexport type Logger<N extends string = LogMethodNames> = {\n\treadonly id: string\n\t/**\n\t * Logger local log level.\n\t */\n\tlevel?: number\n\t/**\n\t * Logs with an increment counter.\n\t * This is useful during debugging to check for steps executed.\n\t */\n\tcount(...args: any[]): void\n\ton(level: number | N, logFunction: LogFunction): void\n\t/**\n\t * Write custom log entries.\n\t */\n\twrite(entry: LogEntry): void\n} & { [k in N]: LogMethod }\n\n/**\n * Names of the standard log methods.\n */\nexport type LogMethodNames =\n\t| 'emergency'\n\t| 'alert'\n\t| 'critical'\n\t| 'error'\n\t| 'warn'\n\t| 'notice'\n\t| 'info'\n\t| 'debug'\n\t| 'trace'\n\t| 'planck'\n\nexport type LogEntry = {\n\tid: string\n\tlevel: number\n\t// args instead of messages because it is `any[]` instead of `string[]`\n\targs: any[]\n\ttimestamp: Date\n}\n\nexport type LogMethod = (...args: any[]) => void\n\nexport type LogFunction = (log: LogMethod, logLevel: number) => string | void\n\nexport type ReporterFilter = string | RegExp | ((reporterId: string) => boolean)\n\nexport interface StandardLogInstance<N extends string = LogMethodNames> {\n\tlogLevel: number\n\ttoLogLevelName(level: number): string\n\ttoLogLevel(name: N): number\n\tgetLogger(id: string, options?: LoggerOptions): Logger<N | LogMethodNames>\n\tgetNonConsoleLogger(id: string, options?: LoggerOptions): Logger<N | LogMethodNames>\n}\n\n/**\n * Formats a log entry.\n * Depends on the reporter, it can expect a different return type.\n * By default the return type is `any[]` which the `console` accepts.\n */\nexport type LogFormatter<T = any[]> = (entry: LogEntry) => T\n\n/**\n * Determines whether the entry should be written.\n */\nexport type LogFilter = (entry: LogEntry) => boolean\n\nexport type LogLevelEntry = { name: string; level: number }\n\nexport interface LogReporter<T = any> {\n\treadonly id: string\n\t/**\n\t * Specifies the formatter to be used by the reporter.\n\t * Using this you can customize how the reporter writes the log entry.\n\t */\n\treadonly formatter: LogFormatter<T>\n\t/**\n\t * Specifies a filter to determine should the log be written.\n\t */\n\treadonly filter?: LogFilter\n\t/**\n\t * Indicate if this is a console reporter.\n\t * There is only one console reporter can be present in the system.\n\t */\n\treadonly isConsoleReporter?: boolean\n\twrite(entry: LogEntry): void\n}\n\nexport type LogReporterOptions<T = any> = {\n\tid?: string\n\t/**\n\t * Specifies the formatter to be used by the reporter.\n\t * Using this you can customize how the reporter writes the log entry.\n\t */\n\tformatter?: LogFormatter<T>\n\t/**\n\t * Specifies a filter to determine should the log be written.\n\t */\n\tfilter?: LogFilter\n}\n\nexport type LogLevel = number\n\nexport interface ConsoleLike {\n\tdebug(...args: any[]): void\n\tinfo(...args: any[]): void\n\twarn(...args: any[]): void\n\terror(...args: any[]): void\n}\n"]}