standard-log 11.1.0 → 11.2.1

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 (72) hide show
  1. package/cjs/errors.d.ts +6 -0
  2. package/cjs/errors.d.ts.map +1 -1
  3. package/cjs/errors.js +6 -0
  4. package/cjs/errors.js.map +1 -1
  5. package/cjs/logLevels.d.ts +1 -1
  6. package/cjs/logLevels.d.ts.map +1 -1
  7. package/cjs/logLevels.js.map +1 -1
  8. package/cjs/logger.d.ts.map +1 -1
  9. package/cjs/logger.js +3 -5
  10. package/cjs/logger.js.map +1 -1
  11. package/cjs/testUtil.js +2 -5
  12. package/cjs/testUtil.js.map +1 -1
  13. package/dist/standard-log.es5.js +9 -5
  14. package/dist/standard-log.es5.js.gz +0 -0
  15. package/dist/standard-log.es5.js.map +1 -1
  16. package/dist/standard-log.es5.js.map.gz +0 -0
  17. package/dist/standard-log.esm.js +9 -6
  18. package/dist/standard-log.esm.js.gz +0 -0
  19. package/dist/standard-log.esm.js.map +1 -1
  20. package/dist/standard-log.esm.js.map.gz +0 -0
  21. package/esm/errors.d.ts +6 -0
  22. package/esm/errors.d.ts.map +1 -1
  23. package/esm/errors.js +6 -0
  24. package/esm/errors.js.map +1 -1
  25. package/esm/logLevels.d.ts +1 -1
  26. package/esm/logLevels.d.ts.map +1 -1
  27. package/esm/logLevels.js.map +1 -1
  28. package/esm/logLevels.spec.d.ts +2 -0
  29. package/esm/logLevels.spec.d.ts.map +1 -0
  30. package/esm/logLevels.spec.js +8 -0
  31. package/esm/logLevels.spec.js.map +1 -0
  32. package/esm/logger.d.ts.map +1 -1
  33. package/esm/logger.js +3 -5
  34. package/esm/logger.js.map +1 -1
  35. package/esm/memory.spec.js +2 -1
  36. package/esm/memory.spec.js.map +1 -1
  37. package/esm/standardLog.spec.js +7 -7
  38. package/esm/standardLog.spec.js.map +1 -1
  39. package/esm/testUtil.js +2 -2
  40. package/esm/testUtil.js.map +1 -1
  41. package/package.json +7 -6
  42. package/ts/errors.ts +7 -0
  43. package/ts/logLevels.ts +1 -1
  44. package/ts/logger.ts +3 -5
  45. package/cjs/console.spec.d.ts +0 -2
  46. package/cjs/console.spec.d.ts.map +0 -1
  47. package/cjs/console.spec.js +0 -185
  48. package/cjs/console.spec.js.map +0 -1
  49. package/cjs/formatter.spec.d.ts +0 -2
  50. package/cjs/formatter.spec.d.ts.map +0 -1
  51. package/cjs/formatter.spec.js +0 -32
  52. package/cjs/formatter.spec.js.map +0 -1
  53. package/cjs/index.spec.d.ts +0 -2
  54. package/cjs/index.spec.d.ts.map +0 -1
  55. package/cjs/index.spec.js +0 -15
  56. package/cjs/index.spec.js.map +0 -1
  57. package/cjs/logStore.spec.d.ts +0 -2
  58. package/cjs/logStore.spec.d.ts.map +0 -1
  59. package/cjs/logStore.spec.js +0 -93
  60. package/cjs/logStore.spec.js.map +0 -1
  61. package/cjs/memory.spec.d.ts +0 -2
  62. package/cjs/memory.spec.d.ts.map +0 -1
  63. package/cjs/memory.spec.js +0 -148
  64. package/cjs/memory.spec.js.map +0 -1
  65. package/cjs/standardLog.spec.d.ts +0 -2
  66. package/cjs/standardLog.spec.d.ts.map +0 -1
  67. package/cjs/standardLog.spec.js +0 -678
  68. package/cjs/standardLog.spec.js.map +0 -1
  69. package/cjs/types.spec.d.ts +0 -2
  70. package/cjs/types.spec.d.ts.map +0 -1
  71. package/cjs/types.spec.js +0 -7
  72. package/cjs/types.spec.js.map +0 -1
Binary file
@@ -269,11 +269,17 @@ __webpack_require__.r(__webpack_exports__);
269
269
  /* harmony export */ });
270
270
  /* harmony import */ var iso_error__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! iso-error */ "../../node_modules/.pnpm/iso-error@4.4.0/node_modules/iso-error/esm/index.js");
271
271
 
272
+ /**
273
+ * @deprecated No longer used since 11.2.0
274
+ */
272
275
  class StandardLogError extends iso_error__WEBPACK_IMPORTED_MODULE_0__.ModuleError {
273
276
  constructor(description, options) {
274
277
  super('standard-log', description, options);
275
278
  }
276
279
  }
280
+ /**
281
+ * @deprecated no longer used since 11.2.0
282
+ */
277
283
  class InvalidId extends StandardLogError {
278
284
  constructor(id, options) {
279
285
  super(`logger id only supports alphanumeric, unicode characters, and [:_-.]. Received ${id}`, options);
@@ -551,13 +557,11 @@ __webpack_require__.r(__webpack_exports__);
551
557
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
552
558
  /* harmony export */ "createLogger": function() { return /* binding */ createLogger; }
553
559
  /* harmony export */ });
554
- /* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./errors.js */ "./ts/errors.ts");
555
560
  /* harmony import */ var _logLevels_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./logLevels.js */ "./ts/logLevels.ts");
556
561
 
557
-
558
562
  function createLogger(store, id, options) {
559
563
  var _a;
560
- validateId(id, options);
564
+ id = sanitizeId(id);
561
565
  const writeTo = (_a = options === null || options === void 0 ? void 0 : options.writeTo) !== null && _a !== void 0 ? _a : (() => true);
562
566
  const [filter, reporters] = typeof writeTo === 'string'
563
567
  ? [id => id === writeTo, store.reporters]
@@ -613,9 +617,8 @@ function createLogger(store, id, options) {
613
617
  });
614
618
  return logger;
615
619
  }
616
- function validateId(id, meta) {
617
- if (/[`~!#$%^&*()=+[\]{},|<>?]/.test(id))
618
- throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidId(id, meta);
620
+ function sanitizeId(id) {
621
+ return id.replace(/[`~!#$%^&*()=+[\]{},|<>?]/g, '-');
619
622
  }
620
623
  function writeToReporters(reporters, logEntry, filter) {
621
624
  reporters.filter(r => filter(r.id)).forEach(r => r.write(logEntry));
Binary file
@@ -1 +1 @@
1
- {"version":3,"file":"standard-log.esm.js","mappings":";;;;;;;;;;AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,eAAe;AAC1B,WAAW,QAAQ;AACnB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;ACjKqC;AACY;AACP;AACF;AAGjC,SAAS,eAAe,CAAC,KAAa;IAC3C,QAAQ,IAAI,EAAE;QACZ,4CAA4C;QAC5C,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,OAAO;QACjC,KAAK,CAAC,KAAK,IAAI,0DAAe,CAAC,CAAC,CAAC,OAAO,OAAO;QAC/C,KAAK,CAAC,KAAK,IAAI,yDAAc,CAAC,CAAC,CAAC,OAAO,MAAM;QAC7C,KAAK,CAAC,KAAK,IAAI,yDAAc,CAAC,CAAC,CAAC,OAAO,MAAM;QAC7C,OAAO,CAAC,CAAC,OAAO,OAAO;KACxB;AACH,CAAC;AAED,uBAAuB;AACvB,+B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G,OAAO,CAAC,SAAS,CAAC;SACrC;KACF;SACI;QACH,GAAG,CAAC,GAAG,GAAG,wBAAwB,CAAC,OAAO,CAAC;KAC5C;IACD,GAAG,CAAC,UAAU,GAAG,IAAI;AACvB,CAAC;;;;;;;;;;;;AChJY;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iBAAiB,GAAG,uBAAuB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAiE,qBAAqB;AACtF;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;;;;;;;;;;;;;;;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,oCAAoC,4BAA4B;AAChE,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,0BAA0B;AAC1C,4CAA4C,6BAA6B;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kCAAkC;AACzD;AACA;AACA;AACA,iBAAiB;AACjB,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,2BAA2B;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,YAAY,0BAA0B;AACtC;AACA;AACA,gEAAgE,6BAA6B;AAC7F;AACA;AACA,8DAA8D,oBAAoB;AAClF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA,gBAAgB;AAChB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,2EAA2E;AAC3G;AACA;AACA;AACA;AACA,yBAAyB,SAAS,GAAG,WAAW,KAAK,YAAY;AACjE;AACA;AACA,yBAAyB,SAAS,IAAI,YAAY;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACO;AACP;AACA;AACA;;;;;;;;;;;;;;;AC5NO;AACP;AACA;AACA;;;;;;;;;;;;;;;ACHA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACPO;AACP;AACA;AACA;AACA;AACA;AACO;AACP;;;;;;;;;;;;;;;;;;ACPO;AACP;AACA,iBAAiB;AACjB,KAAK;AACL;AACO;AACP;AACA;AACA;AACA;AACA;AACA,sDAAsD;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,IAAI;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,6BAA6B,0BAA0B,KAAK;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,IAAI;AACT;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;;;;;;UC3DA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,eAAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACN4B;AACD;AACG;AACA;AACH;AAIF;AAEC","sources":["webpack://StandardLog/../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js","webpack://StandardLog/./ts/console.ts","webpack://StandardLog/./ts/errors.ts","webpack://StandardLog/./ts/formatter.ts","webpack://StandardLog/./ts/logLevels.ts","webpack://StandardLog/./ts/logStore.ts","webpack://StandardLog/./ts/logger.ts","webpack://StandardLog/./ts/memory.ts","webpack://StandardLog/./ts/platform.browser.ts","webpack://StandardLog/./ts/standardLog.ts","webpack://StandardLog/../../node_modules/.pnpm/upper-case@2.0.2/node_modules/upper-case/dist/index.js","webpack://StandardLog/../../node_modules/.pnpm/iso-error@4.4.0/node_modules/iso-error/esm/index.js","webpack://StandardLog/../../node_modules/.pnpm/type-plus@4.13.1/node_modules/type-plus/esm/object/mapKey.js","webpack://StandardLog/../../node_modules/.pnpm/type-plus@4.13.1/node_modules/type-plus/esm/object/record.js","webpack://StandardLog/../../node_modules/.pnpm/type-plus@4.13.1/node_modules/type-plus/esm/object/reduceKey.js","webpack://StandardLog/../../node_modules/.pnpm/unpartial@1.0.4/node_modules/unpartial/esm/index.js","webpack://StandardLog/webpack/bootstrap","webpack://StandardLog/webpack/runtime/compat get default export","webpack://StandardLog/webpack/runtime/define property getters","webpack://StandardLog/webpack/runtime/hasOwnProperty shorthand","webpack://StandardLog/webpack/runtime/make namespace object","webpack://StandardLog/./ts/index.ts"],"sourcesContent":["/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function (val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n","import { unpartial } from 'type-plus'\nimport { consoleFormatter } from './formatter.js'\nimport { logLevels } from './logLevels.js'\nimport { polyfill } from './platform.js'\nimport type { ConsoleLike, LogEntry, LogFormatter, LogReporter, LogReporterOptions } from './types.js'\n\nexport function toConsoleMethod(level: number) {\n switch (true) {\n // edge case in case none is somehow written\n case (level <= 0): return 'debug'\n case (level <= logLevels.error): return 'error'\n case (level <= logLevels.warn): return 'warn'\n case (level <= logLevels.info): return 'info'\n default: return 'debug'\n }\n}\n\n// istanbul ignore next\n/* eslint-disable no-console */\nfunction buildPolyfillConsole() {\n // old phantomjs does not have bind function\n const hasBind = !!console.log.bind as boolean\n if (hasBind) {\n return {\n // the `typeof` guards against IE where `console.log.apply()`\n // results in error `Object doesn't support property or method 'apply'`\n debug: (typeof console.info === 'function' ? console.debug : console.log).bind(console),\n info: (typeof console.info === 'function' ? console.info : console.log).bind(console),\n warn: (typeof console.warn === 'function' ? console.warn : console.log).bind(console),\n error: (typeof console.error === 'function' ? console.error : console.log).bind(console)\n }\n }\n else {\n return {\n debug: buildFn(typeof console.debug === 'function' ? 'debug' : 'log'),\n info: buildFn(typeof console.info === 'function' ? 'info' : 'log'),\n warn: buildFn(typeof console.warn === 'function' ? 'warn' : 'log'),\n error: buildFn(typeof console.error === 'function' ? 'error' : 'log'),\n }\n }\n}\n\n// istanbul ignore next\nfunction buildFn(name: 'debug' | 'info' | 'warn' | 'error' | 'log') {\n return function (...args: any[]) { console[name](...args) }\n}\n\n\nexport type ConsoleLogFormatter = LogFormatter<any[]>\nexport type ConsoleLogReporter = LogReporter<any[]> & { console: ConsoleLike }\nexport type ConsoleLogReporterOptions = LogReporterOptions<any[]>\n\nexport function createConsoleLogReporter(options?: ConsoleLogReporterOptions): ConsoleLogReporter {\n const { id, formatter, filter } = unpartial({ id: 'console', formatter: consoleFormatter }, options)\n if (!polyfill.console) polyfill.console = buildPolyfillConsole()\n\n return Object.freeze({\n id,\n isConsoleReporter: true,\n get formatter() { return formatter },\n get filter() { return filter },\n console: polyfill.console,\n write(entry: LogEntry) {\n if (filter && !filter(entry)) return\n const values = formatter(entry)\n const method = toConsoleMethod(entry.level)\n this.console[method](...values)\n }\n })\n}\n","import { IsoError, ModuleError } from 'iso-error'\n\nexport class StandardLogError extends ModuleError {\n constructor(description: string, options?: IsoError.Options) {\n super('standard-log', description, options)\n }\n}\nexport class InvalidId extends StandardLogError {\n constructor(public id: string, options?: IsoError.Options) {\n super(`logger id only supports alphanumeric, unicode characters, and [:_-.]. Received ${id}`, options)\n }\n}\n","import ms from 'ms'\nimport { upperCase } from 'upper-case'\nimport { toLogLevelName } from './logLevels.js'\nimport type { LogEntry } from './types.js'\n\nexport type TimestampFormat = 'none' | 'iso' | 'elapsed'\n\nexport function createTimestampFormatter(format: TimestampFormat): (timestamp: Date) => string | undefined {\n switch (format) {\n case 'none':\n return (_timestamp: Date) => undefined\n case 'iso':\n return (timestamp: Date) => timestamp.toISOString()\n case 'elapsed': {\n let lastTick: number\n return (timestamp: Date) => {\n const newTick = timestamp.getTime()\n const result = ms(lastTick === undefined ? 0 : newTick - lastTick)\n lastTick = newTick\n return result\n }\n }\n }\n}\n\nexport function formatLogLevel(level: number) {\n return `(${upperCase(toLogLevelName(level))})`\n}\n\n/**\n * Formats log entry as plain text with the following format:\n * `timestamp id level ...args`\n *\n * This is typically useful for writing logs to file\n */\nexport function plainLogFormatter({ id, level, args, timestamp }: LogEntry) {\n return [timestamp.toISOString(), id, formatLogLevel(level), ...args]\n}\n\n/**\n * Formats log entry like default console log.\n */\nexport function consoleFormatter({ args }: LogEntry) {\n return args\n}\n","\nexport const logLevels = {\n /**\n * none: 0\n */\n none: 0 as const,\n /**\n * emergency: 100\n *\n * emergency -> alert\n */\n emergency: 100 as const,\n /**\n * alert: 200\n *\n * emergency -> alert -> critical\n */\n alert: 200 as const,\n /**\n * critical: 300\n *\n * alert -> critical -> error\n */\n critical: 300 as const,\n /**\n * error: 400\n *\n * critical -> error -> warn\n */\n error: 400 as const,\n /**\n * warn: 500\n *\n * error -> warn -> notice\n */\n warn: 500 as const,\n /**\n * notice: 600\n *\n * warn -> notice -> info\n */\n notice: 600 as const,\n /**\n * info: 700\n *\n * notice -> info -> debug\n */\n info: 700 as const,\n /**\n * debug: 800\n *\n * info -> debug -> trace\n */\n debug: 800 as const,\n /**\n * trace: 900\n *\n * debug -> trace -> planck\n */\n trace: 900 as const,\n /**\n * planck: Infinity\n * `planck unit` is a very small unit <https://en.wikipedia.org/wiki/Planck_units>.\n *\n * trace -> planck\n */\n planck: Infinity,\n /**\n * all: Infinity\n */\n all: Infinity\n}\n\n/**\n * Convert default log level value to log level name.\n */\nexport function toLogLevelName(level: number) {\n if (level <= 100) return 'emergency'\n if (level <= 200) return 'alert'\n if (level <= 300) return 'critical'\n if (level <= 400) return 'error'\n if (level <= 500) return 'warn'\n if (level <= 600) return 'notice'\n if (level <= 700) return 'info'\n if (level <= 800) return 'debug'\n if (level <= 900) return 'trace'\n return 'planck'\n}\n\n/**\n * Convert default log level name to log level value.\n */\nexport function toLogLevel(name: string) {\n return (logLevels as any)[name.toLocaleLowerCase()]\n}\n\nexport const DEFAULT_LOG_METHOD_NAMES: string[] = [\n 'emergency',\n 'alert',\n 'critical',\n 'error',\n 'warn',\n 'notice',\n 'info',\n 'debug',\n 'trace',\n 'planck'\n]\n","\nimport { mapKey, record, reduceByKey, reduceKey } from 'type-plus'\nimport { createConsoleLogReporter } from './console.js'\nimport { logLevels, toLogLevel, toLogLevelName } from './logLevels.js'\nimport type { Logger, LogLevel, LogMethodNames, LogReporter, StandardLogOptions } from './types.js'\n\nexport function createLogStore<N extends string = LogMethodNames>(options: Required<StandardLogOptions<N>>): LogStore {\n return {\n loggers: record(),\n nonConsoleLoggers: record(),\n reporters: options.reporters || [createConsoleLogReporter()],\n logLevel: options.logLevel,\n logLevelStore: logLevelStore(options)\n }\n}\n\nexport interface LogStore {\n loggers: Record<string, Logger>,\n nonConsoleLoggers: Record<string, Logger>,\n reporters: LogReporter[],\n logLevel: LogLevel,\n logLevelStore: ReturnType<typeof logLevelStore>\n}\n\nexport interface LogLevelStoreOptions {\n customLevels?: Record<string, number>\n}\n\nexport function logLevelStore(options: LogLevelStoreOptions) {\n const customLevels = options.customLevels || record()\n\n const store = {\n customLevels,\n customLevelsReverse: reduceByKey(customLevels, (p, k) => {\n p[customLevels[k]] = k\n return p\n }, {} as Record<number, string>)\n }\n return {\n getName(level: number) {\n return store.customLevelsReverse[level] ?? toLogLevelName(level)\n },\n getLevel(name: string) {\n return store.customLevels[name] ?? toLogLevel(name)\n },\n getAllLevels() {\n return reduceKey(logLevels, (result, name) => {\n if (name !== 'none' && name !== 'all') result.push({ name, level: logLevels[name] })\n\n return result\n }, mapKey(store.customLevels, name => ({ name, level: store.customLevels[name] })))\n }\n }\n}\n","import type { StackTraceMeta } from '@just-func/types'\nimport { InvalidId } from './errors.js'\nimport { 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 validateId(id, options)\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 const level = logLevels.debug\n if (shouldLog(store, level, logger.level))\n write({\n id,\n level,\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)\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 validateId(id: string, meta?: StackTraceMeta) {\n if (/[`~!#$%^&*()=+[\\]{},|<>?]/.test(id)) throw new InvalidId(id, meta)\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","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","import { record } from 'type-plus'\nimport type { ConsoleLike, LogEntry } from './types.js'\n\nexport const toInspectLogEntry = (e: LogEntry) => e\n\nexport const polyfill: { console?: ConsoleLike } = record()\n","import { record, required } from 'type-plus'\nimport { createLogger } from './logger.js'\nimport { DEFAULT_LOG_METHOD_NAMES, logLevels } from './logLevels.js'\nimport { createLogStore, LogStore } from './logStore.js'\nimport { createMemoryLogReporter, MemoryLogReporter } from './memory.js'\nimport type { Logger, LoggerOptions, LogLevel, LogMethodNames, StandardLogOptions } from './types.js'\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\nexport interface StandardLog<N extends string = LogMethodNames> extends Readonly<StandardLogInstance<N>> {\n}\n\nexport function createStandardLog<N extends string = LogMethodNames>(\n options?: StandardLogOptions<N>\n): StandardLog<N> {\n const closure = createStandardLogClosure(options)\n if (options?.reporters?.some(r => !r.id)) {\n const log = closure.standardLog.getLogger('standard-log')\n log.critical(`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 }\n\n if (!ctx.gsl) ctx.gsl = closure as any\n return closure.standardLog\n}\n\nfunction noop() { }\n\nexport function createStandardLogClosure<N extends string = LogMethodNames>(\n options?: StandardLogOptions<N>\n): { store: LogStore, standardLog: StandardLog<N> } {\n // TODO reporter.id must not be empty\n const store = createLogStore(required({ logLevel: logLevels.info }, options))\n const nonConsoleReporters = options?.reporters?.filter(r => !r.isConsoleReporter).map(r => r.id) ?? []\n const logMethods = DEFAULT_LOG_METHOD_NAMES\n .concat(Object.keys(options?.customLevels ?? {}))\n .concat(['on', 'count', 'write'])\n return {\n store,\n standardLog: {\n get logLevel() { return store.logLevel },\n\n toLogLevelName(level: number) {\n return store.logLevelStore.getName(level)\n },\n toLogLevel(name: string) {\n return store.logLevelStore.getLevel(name)\n },\n getLogger(id: string, options?: LoggerOptions) {\n if (store.loggers[id]) return store.loggers[id] as any\n return store.loggers[id] = createLogger(store, id, { ssf: this.getLogger, ...options }) as any\n },\n getNonConsoleLogger(id, options?) {\n if (store.nonConsoleLoggers[id]) return store.nonConsoleLoggers[id] as any\n\n if (store.loggers[id]) {\n const log = this.getLogger('standard-log')\n log.warn(`attempt to create a non-console logger with existing id ('${id}'), ignoring`)\n return store.nonConsoleLoggers[id] = createDummyLogger(logMethods)\n }\n\n return store.nonConsoleLoggers[id] = nonConsoleReporters.length === 0\n ? createDummyLogger(logMethods)\n : createLogger(store, id, {\n ssf: this.getNonConsoleLogger,\n ...options,\n writeTo(reporterId) {\n return nonConsoleReporters.indexOf(reporterId) >= 0\n }\n })\n },\n }\n }\n}\n\nfunction createDummyLogger(logMethods: string[]) {\n return logMethods.reduce((p, m) => {\n p[m] = noop\n return p\n }, record()) as Logger\n}\n\nexport type StandardLogForTest<N extends string = LogMethodNames> = StandardLog<N> & { reporter: MemoryLogReporter }\n\nexport function createStandardLogForTest<N extends string = LogMethodNames>(\n logLevel: LogLevel = logLevels.debug\n): StandardLogForTest<N> {\n const reporter = createMemoryLogReporter()\n const closure = createStandardLogClosure<N>({ reporters: [reporter], logLevel })\n return { ...closure.standardLog, reporter }\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 const origLevels = logs.map(l => l.level)\n logs.forEach(l => l.level = logLevels.none)\n const result = block()\n logs.forEach((l, i) => l.level = origLevels[i])\n return result\n}\n\nexport function getLogger<N extends string = LogMethodNames>(id: string, options?: LoggerOptions) {\n return getGlobalSL<N>().getLogger(id, options)\n}\n\nexport const ctx: {\n configured?: boolean,\n gsl?: { store: LogStore, standardLog: StandardLogInstance<LogMethodNames> }\n} = record()\n\nfunction getGlobalSL<N extends string = LogMethodNames>(): StandardLogInstance<N> {\n if (!ctx.gsl) ctx.gsl = createStandardLogClosure()\n\n return ctx.gsl!.standardLog as StandardLogInstance<N>\n}\n\nexport function configGlobal(options: Omit<StandardLogOptions, 'customLevels'>) {\n if (ctx.configured) {\n const log = ctx.gsl!.standardLog.getLogger('standard-log')\n log.warn('configGlobal() is being called more than once. Please make sure this is expected. Application should use `createStandardLog()` most of the time.')\n }\n\n if (ctx.gsl) {\n if (options.logLevel) {\n ctx.gsl.store.logLevel = options.logLevel\n }\n if (options.reporters) {\n const reporters = ctx.gsl.store.reporters\n reporters.length = 0\n reporters.push(...options.reporters)\n }\n }\n else {\n ctx.gsl = createStandardLogClosure(options)\n }\n ctx.configured = true\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.upperCase = exports.localeUpperCase = void 0;\n/**\n * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt\n */\nvar SUPPORTED_LOCALE = {\n tr: {\n regexp: /[\\u0069]/g,\n map: {\n i: \"\\u0130\",\n },\n },\n az: {\n regexp: /[\\u0069]/g,\n map: {\n i: \"\\u0130\",\n },\n },\n lt: {\n regexp: /[\\u0069\\u006A\\u012F]\\u0307|\\u0069\\u0307[\\u0300\\u0301\\u0303]/g,\n map: {\n i̇: \"\\u0049\",\n j̇: \"\\u004A\",\n į̇: \"\\u012E\",\n i̇̀: \"\\u00CC\",\n i̇́: \"\\u00CD\",\n i̇̃: \"\\u0128\",\n },\n },\n};\n/**\n * Localized upper case.\n */\nfunction localeUpperCase(str, locale) {\n var lang = SUPPORTED_LOCALE[locale.toLowerCase()];\n if (lang)\n return upperCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));\n return upperCase(str);\n}\nexports.localeUpperCase = localeUpperCase;\n/**\n * Upper case as a function.\n */\nfunction upperCase(str) {\n return str.toUpperCase();\n}\nexports.upperCase = upperCase;\n//# sourceMappingURL=index.js.map","/* eslint-disable @typescript-eslint/unbound-method */\n//#region captureStackTrace polyfill\n// istanbul ignore next\nif (!Error.captureStackTrace) {\n Error.captureStackTrace = function (error) {\n const container = new Error();\n Object.defineProperty(error, 'stack', {\n configurable: true,\n get: function () {\n // Replace property with value for faster future accesses.\n defineStack(this, container.stack);\n return container.stack;\n },\n set: function (stack) { defineStack(error, stack); },\n });\n };\n}\n// istanbul ignore next\nfunction defineStack(target, value) {\n Object.defineProperty(target, 'stack', {\n configurable: true,\n value,\n writable: true,\n });\n}\nconst serializers = [];\nconst deserializers = [];\n/**\n * Isomorphic Error that works across physical boundary.\n */\nexport class IsoError extends Error {\n constructor(message, options) {\n super(message);\n /**\n * Name of the error\n */\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n /**\n * Error cause\n */\n Object.defineProperty(this, \"cause\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n //restore prototype chain\n const actualProto = new.target.prototype;\n this.name = actualProto.constructor.name;\n // istanbul ignore next\n if (Object.setPrototypeOf)\n Object.setPrototypeOf(this, actualProto);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n else\n this.__proto__ = actualProto;\n if (options?.cause)\n this.cause = toIsoError(options.cause);\n if (options?.ssf)\n Error.captureStackTrace(this, options.ssf);\n }\n /**\n * Create an IsoError with additional properties without the need to create a new class.\n * @param props properties of the IsoError\n */\n static create(props) {\n const { message, cause, ...rest } = props;\n const err = new IsoError(message, { cause, ssf: IsoError.create });\n return Object.assign(err, rest);\n }\n static stringify(err) {\n return this.serialize(err);\n }\n static serialize(err) {\n return JSON.stringify(this.toSerializable(err));\n }\n /**\n * @type P Additional properties of the IsoError\n * @param text Json representation of a IsoError\n */\n static parse(text) {\n return deserialize(IsoError.parse, text);\n }\n /**\n * @type P Additional properties of the IsoError\n * @param text Json representation of a IsoError\n */\n static deserialize(text) {\n return deserialize(IsoError.deserialize, text);\n }\n static toSerializable(err) {\n return serializers.reduce((p, s) => p || s(err), undefined)\n || toSerializableError(err);\n }\n static fromSerializable(json) {\n const err = deserializeError(json);\n Error.captureStackTrace(err, IsoError.fromSerializable);\n return err;\n }\n /**\n * returns the error message including the error causes.\n */\n static trace(err) {\n return trace(err);\n }\n static addPlugin({ toSerializable, fromSerializable }) {\n serializers.unshift(toSerializable);\n deserializers.unshift(fromSerializable);\n }\n toString() { return IsoError.serialize(this); }\n trace() { return IsoError.trace(this); }\n}\nfunction deserialize(fn, text) {\n const json = JSON.parse(text);\n const err = deserializeError(json);\n Error.captureStackTrace(err, fn);\n return err;\n}\nfunction deserializeError(json) {\n let err = undefined;\n for (const d of deserializers) {\n err = d(json);\n if (err)\n break;\n }\n return err || defaultDeserializeError(json);\n}\nfunction defaultDeserializeError(json) {\n if (json.name === 'AggregateError') {\n const { message, errors, ...rest } = json;\n // @ts-ignore\n if (global.AggregateError) {\n return Object.assign(new AggregateError(errors, message), rest);\n }\n else {\n return Object.assign(new Error(message), {\n ...rest,\n errors\n });\n }\n }\n const { message, cause, ...rest } = json;\n const causeError = cause ? deserializeError(cause) : undefined;\n if (json.name === 'Error') {\n return Object.assign(new Error(message), causeError ? { ...rest, cause: causeError } : rest);\n }\n // @ts-ignore\n return Object.assign(new IsoError(message, causeError ? { cause: causeError } : undefined), rest);\n}\nfunction toSerializableError(err) {\n if (isAggregateError(err)) {\n return {\n ...err, name: err.constructor.name, message: err.message,\n errors: err.errors.map(toSerializableError)\n };\n }\n if (err instanceof Error) {\n const { message, cause } = err;\n return cause\n ? { ...err, name: err.constructor.name, message, cause: toSerializableError(cause) }\n : { ...err, name: err.constructor.name, message };\n }\n return err;\n}\n// NOTE: In this function I have to to Object.assign to keep the err instance and its stack trace.\nfunction toIsoError(err) {\n if (err instanceof IsoError)\n return err;\n // When the error is an internal error from deserialzation,\n // the err.constructor.name is object\n return Object.assign(err, { name: err.constructor.name !== 'Object' ? err.constructor.name : err.name });\n}\nfunction trace(err) {\n const messages = [];\n if (err instanceof ModuleError) {\n messages.push(`${err.name}(${err.module}): ${err.message}`);\n }\n else if (err instanceof Error) {\n messages.push(`${err.name}: ${err.message}`);\n }\n if (isAggregateError(err)) {\n err.errors.forEach(e => messages.push(...trace(e).split('\\n').map(s => ' ' + s)));\n }\n if (err instanceof Error) {\n if (hasCause(err))\n messages.push(...trace(err.cause).split('\\n').map(s => ' ' + s));\n }\n else {\n messages.push(typeof err === 'string' ? err : JSON.stringify(err));\n }\n return messages.join('\\n');\n}\nfunction hasCause(x) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return !!x.cause;\n}\n/**\n * An IsoError with a module property.\n */\nexport class ModuleError extends IsoError {\n /**\n * @param module The module that defines this error.\n */\n constructor(module, message, options) {\n super(message, options);\n Object.defineProperty(this, \"module\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: module\n });\n }\n}\nexport function isAggregateError(error) {\n return error instanceof Error && Array.isArray(error.errors);\n}\n//# sourceMappingURL=index.js.map","export function mapKey(subject, predicate, thisArg) {\n return Object.keys(subject).map(predicate, thisArg);\n}\n//# sourceMappingURL=mapKey.js.map","/**\n * Creates a `Record<Key, Value>`\n */\nexport function record(value) {\n const r = Object.create(null);\n return (value ? Object.assign(r, value) : r);\n}\n//# sourceMappingURL=record.js.map","export function reduceByKey(subject, callbackfn, initialValue) {\n return Object.keys(subject).reduce(callbackfn, initialValue);\n}\n/**\n * @deprecated renamed to reduceByKey\n */\nexport const reduceKey = reduceByKey;\n//# sourceMappingURL=reduceKey.js.map","export function required(source1, source2, source3) {\n return merge([source1, source2, source3], (p, e) => {\n return { ...p, ...e };\n });\n}\nexport function requiredDeep(source1, source2, source3) {\n return merge([source1, source2, source3], (p, e) => deepmerge(p, e));\n}\nfunction merge(entries, reducer) {\n if (entries[0] === undefined || entries[0] === null)\n return entries[0];\n return entries.filter(x => !!x).reduce(reducer, {});\n}\nfunction deepmerge(source1, source2) {\n if (typeof source1 !== 'object' || source1 === null)\n return source2 !== undefined ? source2 : source1;\n if (Array.isArray(source1)) {\n if (Array.isArray(source2))\n return source2;\n if (source2 === undefined)\n return [...source1];\n return [...source1, source2];\n }\n return getAllKeys(source1).concat(getAllKeys(source2)).reduce((p, k) => {\n // @ts-ignore\n p[k] = deepmerge(source1[k], source2 && source2[k]);\n return p;\n }, {});\n}\nfunction getAllKeys(subject, internal = false) {\n if (typeof subject !== 'object')\n return [];\n const propertyNames = Object.getOwnPropertyNames(subject);\n const keys = internal ? propertyNames.filter(n => n !== 'constructor') : propertyNames;\n const proto = Object.getPrototypeOf(subject);\n return proto !== Object.prototype ? keys.concat(getAllKeys(proto, true)) : keys;\n}\nexport function unpartial(s1, s2, s3) {\n // defensive check for JS\n if (s1 === undefined || s1 === null)\n return s1;\n return [s1, s2, s3]\n .filter(notNil)\n .reduce((p, s) => ({ ...p, ...trimNilProps(s) }), {});\n}\nfunction trimNilProps(value) {\n return Object.keys(value).reduce((p, k) => {\n if (notNil(value[k]))\n p[k] = value[k];\n return p;\n }, {});\n}\nfunction notNil(value) {\n return value !== null && value !== undefined;\n}\nexport function unpartialRecursively(arg1, arg2, arg3) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n return requiredDeep(arg1, arg2, arg3);\n}\n//# sourceMappingURL=index.js.map","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export * from './console.js'\nexport * from './errors.js'\nexport * from './formatter.js'\nexport * from './logLevels.js'\nexport * from './memory.js'\nexport {\n configGlobal, createStandardLog, createStandardLogForTest,\n getLogger, suppressLogs\n} from './standardLog.js'\nexport type { StandardLog, StandardLogForTest, StandardLogInstance } from './standardLog.js'\nexport * from './types.js'\n"],"names":[],"sourceRoot":""}
1
+ {"version":3,"file":"standard-log.esm.js","mappings":";;;;;;;;;;AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,eAAe;AAC1B,WAAW,QAAQ;AACnB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;ACjKqC;AACY;AACP;AACF;AAGjC,SAAS,eAAe,CAAC,KAAa;IAC3C,QAAQ,IAAI,EAAE;QACZ,4CAA4C;QAC5C,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,OAAO;QACjC,KAAK,CAAC,KAAK,IAAI,0DAAe,CAAC,CAAC,CAAC,OAAO,OAAO;QAC/C,KAAK,CAAC,KAAK,IAAI,yDAAc,CAAC,CAAC,CAAC,OAAO,MAAM;QAC7C,KAAK,CAAC,KAAK,IAAI,yDAAc,CAAC,CAAC,CAAC,OAAO,MAAM;QAC7C,OAAO,CAAC,CAAC,OAAO,OAAO;KACxB;AACH,CAAC;AAED,uBAAuB;AACvB,+BAA+B;AAC/B,SAAS,oBAAoB;IAC3B,4CAA4C;IAC5C,MAAM,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,G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G,IAAI;AACvB,CAAC;;;;;;;;;;;;AChJY;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iBAAiB,GAAG,uBAAuB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAiE,qBAAqB;AACtF;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;;;;;;;;;;;;;;;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,oCAAoC,4BAA4B;AAChE,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,0BAA0B;AAC1C,4CAA4C,6BAA6B;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kCAAkC;AACzD;AACA;AACA;AACA,iBAAiB;AACjB,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,2BAA2B;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,YAAY,0BAA0B;AACtC;AACA;AACA,gEAAgE,6BAA6B;AAC7F;AACA;AACA,8DAA8D,oBAAoB;AAClF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA,gBAAgB;AAChB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,2EAA2E;AAC3G;AACA;AACA;AACA;AACA,yBAAyB,SAAS,GAAG,WAAW,KAAK,YAAY;AACjE;AACA;AACA,yBAAyB,SAAS,IAAI,YAAY;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACO;AACP;AACA;AACA;;;;;;;;;;;;;;;AC5NO;AACP;AACA;AACA;;;;;;;;;;;;;;;ACHA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACPO;AACP;AACA;AACA;AACA;AACA;AACO;AACP;;;;;;;;;;;;;;;;;;ACPO;AACP;AACA,iBAAiB;AACjB,KAAK;AACL;AACO;AACP;AACA;AACA;AACA;AACA;AACA,sDAAsD;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,IAAI;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,6BAA6B,0BAA0B,KAAK;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,IAAI;AACT;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;;;;;;UC3DA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,eAAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACN4B;AACD;AACG;AACA;AACH;AAIF;AAEC","sources":["webpack://StandardLog/../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js","webpack://StandardLog/./ts/console.ts","webpack://StandardLog/./ts/errors.ts","webpack://StandardLog/./ts/formatter.ts","webpack://StandardLog/./ts/logLevels.ts","webpack://StandardLog/./ts/logStore.ts","webpack://StandardLog/./ts/logger.ts","webpack://StandardLog/./ts/memory.ts","webpack://StandardLog/./ts/platform.browser.ts","webpack://StandardLog/./ts/standardLog.ts","webpack://StandardLog/../../node_modules/.pnpm/upper-case@2.0.2/node_modules/upper-case/dist/index.js","webpack://StandardLog/../../node_modules/.pnpm/iso-error@4.4.0/node_modules/iso-error/esm/index.js","webpack://StandardLog/../../node_modules/.pnpm/type-plus@4.13.1/node_modules/type-plus/esm/object/mapKey.js","webpack://StandardLog/../../node_modules/.pnpm/type-plus@4.13.1/node_modules/type-plus/esm/object/record.js","webpack://StandardLog/../../node_modules/.pnpm/type-plus@4.13.1/node_modules/type-plus/esm/object/reduceKey.js","webpack://StandardLog/../../node_modules/.pnpm/unpartial@1.0.4/node_modules/unpartial/esm/index.js","webpack://StandardLog/webpack/bootstrap","webpack://StandardLog/webpack/runtime/compat get default export","webpack://StandardLog/webpack/runtime/define property getters","webpack://StandardLog/webpack/runtime/hasOwnProperty shorthand","webpack://StandardLog/webpack/runtime/make namespace object","webpack://StandardLog/./ts/index.ts"],"sourcesContent":["/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function (val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n","import { unpartial } from 'type-plus'\nimport { consoleFormatter } from './formatter.js'\nimport { logLevels } from './logLevels.js'\nimport { polyfill } from './platform.js'\nimport type { ConsoleLike, LogEntry, LogFormatter, LogReporter, LogReporterOptions } from './types.js'\n\nexport function toConsoleMethod(level: number) {\n switch (true) {\n // edge case in case none is somehow written\n case (level <= 0): return 'debug'\n case (level <= logLevels.error): return 'error'\n case (level <= logLevels.warn): return 'warn'\n case (level <= logLevels.info): return 'info'\n default: return 'debug'\n }\n}\n\n// istanbul ignore next\n/* eslint-disable no-console */\nfunction buildPolyfillConsole() {\n // old phantomjs does not have bind function\n const hasBind = !!console.log.bind as boolean\n if (hasBind) {\n return {\n // the `typeof` guards against IE where `console.log.apply()`\n // results in error `Object doesn't support property or method 'apply'`\n debug: (typeof console.info === 'function' ? console.debug : console.log).bind(console),\n info: (typeof console.info === 'function' ? console.info : console.log).bind(console),\n warn: (typeof console.warn === 'function' ? console.warn : console.log).bind(console),\n error: (typeof console.error === 'function' ? console.error : console.log).bind(console)\n }\n }\n else {\n return {\n debug: buildFn(typeof console.debug === 'function' ? 'debug' : 'log'),\n info: buildFn(typeof console.info === 'function' ? 'info' : 'log'),\n warn: buildFn(typeof console.warn === 'function' ? 'warn' : 'log'),\n error: buildFn(typeof console.error === 'function' ? 'error' : 'log'),\n }\n }\n}\n\n// istanbul ignore next\nfunction buildFn(name: 'debug' | 'info' | 'warn' | 'error' | 'log') {\n return function (...args: any[]) { console[name](...args) }\n}\n\n\nexport type ConsoleLogFormatter = LogFormatter<any[]>\nexport type ConsoleLogReporter = LogReporter<any[]> & { console: ConsoleLike }\nexport type ConsoleLogReporterOptions = LogReporterOptions<any[]>\n\nexport function createConsoleLogReporter(options?: ConsoleLogReporterOptions): ConsoleLogReporter {\n const { id, formatter, filter } = unpartial({ id: 'console', formatter: consoleFormatter }, options)\n if (!polyfill.console) polyfill.console = buildPolyfillConsole()\n\n return Object.freeze({\n id,\n isConsoleReporter: true,\n get formatter() { return formatter },\n get filter() { return filter },\n console: polyfill.console,\n write(entry: LogEntry) {\n if (filter && !filter(entry)) return\n const values = formatter(entry)\n const method = toConsoleMethod(entry.level)\n this.console[method](...values)\n }\n })\n}\n","import { IsoError, ModuleError } from 'iso-error'\n\n/**\n * @deprecated No longer used since 11.2.0\n */\nexport class StandardLogError extends ModuleError {\n constructor(description: string, options?: IsoError.Options) {\n super('standard-log', description, options)\n }\n}\n\n/**\n * @deprecated no longer used since 11.2.0\n */\nexport class InvalidId extends StandardLogError {\n constructor(public id: string, options?: IsoError.Options) {\n super(`logger id only supports alphanumeric, unicode characters, and [:_-.]. Received ${id}`, options)\n }\n}\n","import ms from 'ms'\nimport { upperCase } from 'upper-case'\nimport { toLogLevelName } from './logLevels.js'\nimport type { LogEntry } from './types.js'\n\nexport type TimestampFormat = 'none' | 'iso' | 'elapsed'\n\nexport function createTimestampFormatter(format: TimestampFormat): (timestamp: Date) => string | undefined {\n switch (format) {\n case 'none':\n return (_timestamp: Date) => undefined\n case 'iso':\n return (timestamp: Date) => timestamp.toISOString()\n case 'elapsed': {\n let lastTick: number\n return (timestamp: Date) => {\n const newTick = timestamp.getTime()\n const result = ms(lastTick === undefined ? 0 : newTick - lastTick)\n lastTick = newTick\n return result\n }\n }\n }\n}\n\nexport function formatLogLevel(level: number) {\n return `(${upperCase(toLogLevelName(level))})`\n}\n\n/**\n * Formats log entry as plain text with the following format:\n * `timestamp id level ...args`\n *\n * This is typically useful for writing logs to file\n */\nexport function plainLogFormatter({ id, level, args, timestamp }: LogEntry) {\n return [timestamp.toISOString(), id, formatLogLevel(level), ...args]\n}\n\n/**\n * Formats log entry like default console log.\n */\nexport function consoleFormatter({ args }: LogEntry) {\n return args\n}\n","\nexport const logLevels = {\n /**\n * none: 0\n */\n none: 0 as const,\n /**\n * emergency: 100\n *\n * emergency -> alert\n */\n emergency: 100 as const,\n /**\n * alert: 200\n *\n * emergency -> alert -> critical\n */\n alert: 200 as const,\n /**\n * critical: 300\n *\n * alert -> critical -> error\n */\n critical: 300 as const,\n /**\n * error: 400\n *\n * critical -> error -> warn\n */\n error: 400 as const,\n /**\n * warn: 500\n *\n * error -> warn -> notice\n */\n warn: 500 as const,\n /**\n * notice: 600\n *\n * warn -> notice -> info\n */\n notice: 600 as const,\n /**\n * info: 700\n *\n * notice -> info -> debug\n */\n info: 700 as const,\n /**\n * debug: 800\n *\n * info -> debug -> trace\n */\n debug: 800 as const,\n /**\n * trace: 900\n *\n * debug -> trace -> planck\n */\n trace: 900 as const,\n /**\n * planck: Infinity\n * `planck unit` is a very small unit <https://en.wikipedia.org/wiki/Planck_units>.\n *\n * trace -> planck\n */\n planck: Infinity,\n /**\n * all: Infinity\n */\n all: Infinity\n}\n\n/**\n * Convert default log level value to log level name.\n */\nexport function toLogLevelName(level: number) {\n if (level <= 100) return 'emergency'\n if (level <= 200) return 'alert'\n if (level <= 300) return 'critical'\n if (level <= 400) return 'error'\n if (level <= 500) return 'warn'\n if (level <= 600) return 'notice'\n if (level <= 700) return 'info'\n if (level <= 800) return 'debug'\n if (level <= 900) return 'trace'\n return 'planck'\n}\n\n/**\n * Convert default log level name to log level value.\n */\nexport function toLogLevel(name: string): number | undefined {\n return (logLevels as any)[name.toLocaleLowerCase()]\n}\n\nexport const DEFAULT_LOG_METHOD_NAMES: string[] = [\n 'emergency',\n 'alert',\n 'critical',\n 'error',\n 'warn',\n 'notice',\n 'info',\n 'debug',\n 'trace',\n 'planck'\n]\n","\nimport { mapKey, record, reduceByKey, reduceKey } from 'type-plus'\nimport { createConsoleLogReporter } from './console.js'\nimport { logLevels, toLogLevel, toLogLevelName } from './logLevels.js'\nimport type { Logger, LogLevel, LogMethodNames, LogReporter, StandardLogOptions } from './types.js'\n\nexport function createLogStore<N extends string = LogMethodNames>(options: Required<StandardLogOptions<N>>): LogStore {\n return {\n loggers: record(),\n nonConsoleLoggers: record(),\n reporters: options.reporters || [createConsoleLogReporter()],\n logLevel: options.logLevel,\n logLevelStore: logLevelStore(options)\n }\n}\n\nexport interface LogStore {\n loggers: Record<string, Logger>,\n nonConsoleLoggers: Record<string, Logger>,\n reporters: LogReporter[],\n logLevel: LogLevel,\n logLevelStore: ReturnType<typeof logLevelStore>\n}\n\nexport interface LogLevelStoreOptions {\n customLevels?: Record<string, number>\n}\n\nexport function logLevelStore(options: LogLevelStoreOptions) {\n const customLevels = options.customLevels || record()\n\n const store = {\n customLevels,\n customLevelsReverse: reduceByKey(customLevels, (p, k) => {\n p[customLevels[k]] = k\n return p\n }, {} as Record<number, string>)\n }\n return {\n getName(level: number) {\n return store.customLevelsReverse[level] ?? toLogLevelName(level)\n },\n getLevel(name: string) {\n return store.customLevels[name] ?? toLogLevel(name)\n },\n getAllLevels() {\n return reduceKey(logLevels, (result, name) => {\n if (name !== 'none' && name !== 'all') result.push({ name, level: logLevels[name] })\n\n return result\n }, mapKey(store.customLevels, name => ({ name, level: store.customLevels[name] })))\n }\n }\n}\n","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 const level = logLevels.debug\n if (shouldLog(store, level, logger.level))\n write({\n id,\n level,\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)\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","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","import { record } from 'type-plus'\nimport type { ConsoleLike, LogEntry } from './types.js'\n\nexport const toInspectLogEntry = (e: LogEntry) => e\n\nexport const polyfill: { console?: ConsoleLike } = record()\n","import { record, required } from 'type-plus'\nimport { createLogger } from './logger.js'\nimport { DEFAULT_LOG_METHOD_NAMES, logLevels } from './logLevels.js'\nimport { createLogStore, LogStore } from './logStore.js'\nimport { createMemoryLogReporter, MemoryLogReporter } from './memory.js'\nimport type { Logger, LoggerOptions, LogLevel, LogMethodNames, StandardLogOptions } from './types.js'\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\nexport interface StandardLog<N extends string = LogMethodNames> extends Readonly<StandardLogInstance<N>> {\n}\n\nexport function createStandardLog<N extends string = LogMethodNames>(\n options?: StandardLogOptions<N>\n): StandardLog<N> {\n const closure = createStandardLogClosure(options)\n if (options?.reporters?.some(r => !r.id)) {\n const log = closure.standardLog.getLogger('standard-log')\n log.critical(`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 }\n\n if (!ctx.gsl) ctx.gsl = closure as any\n return closure.standardLog\n}\n\nfunction noop() { }\n\nexport function createStandardLogClosure<N extends string = LogMethodNames>(\n options?: StandardLogOptions<N>\n): { store: LogStore, standardLog: StandardLog<N> } {\n // TODO reporter.id must not be empty\n const store = createLogStore(required({ logLevel: logLevels.info }, options))\n const nonConsoleReporters = options?.reporters?.filter(r => !r.isConsoleReporter).map(r => r.id) ?? []\n const logMethods = DEFAULT_LOG_METHOD_NAMES\n .concat(Object.keys(options?.customLevels ?? {}))\n .concat(['on', 'count', 'write'])\n return {\n store,\n standardLog: {\n get logLevel() { return store.logLevel },\n\n toLogLevelName(level: number) {\n return store.logLevelStore.getName(level)\n },\n toLogLevel(name: string) {\n return store.logLevelStore.getLevel(name)\n },\n getLogger(id: string, options?: LoggerOptions) {\n if (store.loggers[id]) return store.loggers[id] as any\n return store.loggers[id] = createLogger(store, id, { ssf: this.getLogger, ...options }) as any\n },\n getNonConsoleLogger(id, options?) {\n if (store.nonConsoleLoggers[id]) return store.nonConsoleLoggers[id] as any\n\n if (store.loggers[id]) {\n const log = this.getLogger('standard-log')\n log.warn(`attempt to create a non-console logger with existing id ('${id}'), ignoring`)\n return store.nonConsoleLoggers[id] = createDummyLogger(logMethods)\n }\n\n return store.nonConsoleLoggers[id] = nonConsoleReporters.length === 0\n ? createDummyLogger(logMethods)\n : createLogger(store, id, {\n ssf: this.getNonConsoleLogger,\n ...options,\n writeTo(reporterId) {\n return nonConsoleReporters.indexOf(reporterId) >= 0\n }\n })\n },\n }\n }\n}\n\nfunction createDummyLogger(logMethods: string[]) {\n return logMethods.reduce((p, m) => {\n p[m] = noop\n return p\n }, record()) as Logger\n}\n\nexport type StandardLogForTest<N extends string = LogMethodNames> = StandardLog<N> & { reporter: MemoryLogReporter }\n\nexport function createStandardLogForTest<N extends string = LogMethodNames>(\n logLevel: LogLevel = logLevels.debug\n): StandardLogForTest<N> {\n const reporter = createMemoryLogReporter()\n const closure = createStandardLogClosure<N>({ reporters: [reporter], logLevel })\n return { ...closure.standardLog, reporter }\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 const origLevels = logs.map(l => l.level)\n logs.forEach(l => l.level = logLevels.none)\n const result = block()\n logs.forEach((l, i) => l.level = origLevels[i])\n return result\n}\n\nexport function getLogger<N extends string = LogMethodNames>(id: string, options?: LoggerOptions) {\n return getGlobalSL<N>().getLogger(id, options)\n}\n\nexport const ctx: {\n configured?: boolean,\n gsl?: { store: LogStore, standardLog: StandardLogInstance<LogMethodNames> }\n} = record()\n\nfunction getGlobalSL<N extends string = LogMethodNames>(): StandardLogInstance<N> {\n if (!ctx.gsl) ctx.gsl = createStandardLogClosure()\n\n return ctx.gsl!.standardLog as StandardLogInstance<N>\n}\n\nexport function configGlobal(options: Omit<StandardLogOptions, 'customLevels'>) {\n if (ctx.configured) {\n const log = ctx.gsl!.standardLog.getLogger('standard-log')\n log.warn('configGlobal() is being called more than once. Please make sure this is expected. Application should use `createStandardLog()` most of the time.')\n }\n\n if (ctx.gsl) {\n if (options.logLevel) {\n ctx.gsl.store.logLevel = options.logLevel\n }\n if (options.reporters) {\n const reporters = ctx.gsl.store.reporters\n reporters.length = 0\n reporters.push(...options.reporters)\n }\n }\n else {\n ctx.gsl = createStandardLogClosure(options)\n }\n ctx.configured = true\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.upperCase = exports.localeUpperCase = void 0;\n/**\n * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt\n */\nvar SUPPORTED_LOCALE = {\n tr: {\n regexp: /[\\u0069]/g,\n map: {\n i: \"\\u0130\",\n },\n },\n az: {\n regexp: /[\\u0069]/g,\n map: {\n i: \"\\u0130\",\n },\n },\n lt: {\n regexp: /[\\u0069\\u006A\\u012F]\\u0307|\\u0069\\u0307[\\u0300\\u0301\\u0303]/g,\n map: {\n i̇: \"\\u0049\",\n j̇: \"\\u004A\",\n į̇: \"\\u012E\",\n i̇̀: \"\\u00CC\",\n i̇́: \"\\u00CD\",\n i̇̃: \"\\u0128\",\n },\n },\n};\n/**\n * Localized upper case.\n */\nfunction localeUpperCase(str, locale) {\n var lang = SUPPORTED_LOCALE[locale.toLowerCase()];\n if (lang)\n return upperCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));\n return upperCase(str);\n}\nexports.localeUpperCase = localeUpperCase;\n/**\n * Upper case as a function.\n */\nfunction upperCase(str) {\n return str.toUpperCase();\n}\nexports.upperCase = upperCase;\n//# sourceMappingURL=index.js.map","/* eslint-disable @typescript-eslint/unbound-method */\n//#region captureStackTrace polyfill\n// istanbul ignore next\nif (!Error.captureStackTrace) {\n Error.captureStackTrace = function (error) {\n const container = new Error();\n Object.defineProperty(error, 'stack', {\n configurable: true,\n get: function () {\n // Replace property with value for faster future accesses.\n defineStack(this, container.stack);\n return container.stack;\n },\n set: function (stack) { defineStack(error, stack); },\n });\n };\n}\n// istanbul ignore next\nfunction defineStack(target, value) {\n Object.defineProperty(target, 'stack', {\n configurable: true,\n value,\n writable: true,\n });\n}\nconst serializers = [];\nconst deserializers = [];\n/**\n * Isomorphic Error that works across physical boundary.\n */\nexport class IsoError extends Error {\n constructor(message, options) {\n super(message);\n /**\n * Name of the error\n */\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n /**\n * Error cause\n */\n Object.defineProperty(this, \"cause\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n //restore prototype chain\n const actualProto = new.target.prototype;\n this.name = actualProto.constructor.name;\n // istanbul ignore next\n if (Object.setPrototypeOf)\n Object.setPrototypeOf(this, actualProto);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n else\n this.__proto__ = actualProto;\n if (options?.cause)\n this.cause = toIsoError(options.cause);\n if (options?.ssf)\n Error.captureStackTrace(this, options.ssf);\n }\n /**\n * Create an IsoError with additional properties without the need to create a new class.\n * @param props properties of the IsoError\n */\n static create(props) {\n const { message, cause, ...rest } = props;\n const err = new IsoError(message, { cause, ssf: IsoError.create });\n return Object.assign(err, rest);\n }\n static stringify(err) {\n return this.serialize(err);\n }\n static serialize(err) {\n return JSON.stringify(this.toSerializable(err));\n }\n /**\n * @type P Additional properties of the IsoError\n * @param text Json representation of a IsoError\n */\n static parse(text) {\n return deserialize(IsoError.parse, text);\n }\n /**\n * @type P Additional properties of the IsoError\n * @param text Json representation of a IsoError\n */\n static deserialize(text) {\n return deserialize(IsoError.deserialize, text);\n }\n static toSerializable(err) {\n return serializers.reduce((p, s) => p || s(err), undefined)\n || toSerializableError(err);\n }\n static fromSerializable(json) {\n const err = deserializeError(json);\n Error.captureStackTrace(err, IsoError.fromSerializable);\n return err;\n }\n /**\n * returns the error message including the error causes.\n */\n static trace(err) {\n return trace(err);\n }\n static addPlugin({ toSerializable, fromSerializable }) {\n serializers.unshift(toSerializable);\n deserializers.unshift(fromSerializable);\n }\n toString() { return IsoError.serialize(this); }\n trace() { return IsoError.trace(this); }\n}\nfunction deserialize(fn, text) {\n const json = JSON.parse(text);\n const err = deserializeError(json);\n Error.captureStackTrace(err, fn);\n return err;\n}\nfunction deserializeError(json) {\n let err = undefined;\n for (const d of deserializers) {\n err = d(json);\n if (err)\n break;\n }\n return err || defaultDeserializeError(json);\n}\nfunction defaultDeserializeError(json) {\n if (json.name === 'AggregateError') {\n const { message, errors, ...rest } = json;\n // @ts-ignore\n if (global.AggregateError) {\n return Object.assign(new AggregateError(errors, message), rest);\n }\n else {\n return Object.assign(new Error(message), {\n ...rest,\n errors\n });\n }\n }\n const { message, cause, ...rest } = json;\n const causeError = cause ? deserializeError(cause) : undefined;\n if (json.name === 'Error') {\n return Object.assign(new Error(message), causeError ? { ...rest, cause: causeError } : rest);\n }\n // @ts-ignore\n return Object.assign(new IsoError(message, causeError ? { cause: causeError } : undefined), rest);\n}\nfunction toSerializableError(err) {\n if (isAggregateError(err)) {\n return {\n ...err, name: err.constructor.name, message: err.message,\n errors: err.errors.map(toSerializableError)\n };\n }\n if (err instanceof Error) {\n const { message, cause } = err;\n return cause\n ? { ...err, name: err.constructor.name, message, cause: toSerializableError(cause) }\n : { ...err, name: err.constructor.name, message };\n }\n return err;\n}\n// NOTE: In this function I have to to Object.assign to keep the err instance and its stack trace.\nfunction toIsoError(err) {\n if (err instanceof IsoError)\n return err;\n // When the error is an internal error from deserialzation,\n // the err.constructor.name is object\n return Object.assign(err, { name: err.constructor.name !== 'Object' ? err.constructor.name : err.name });\n}\nfunction trace(err) {\n const messages = [];\n if (err instanceof ModuleError) {\n messages.push(`${err.name}(${err.module}): ${err.message}`);\n }\n else if (err instanceof Error) {\n messages.push(`${err.name}: ${err.message}`);\n }\n if (isAggregateError(err)) {\n err.errors.forEach(e => messages.push(...trace(e).split('\\n').map(s => ' ' + s)));\n }\n if (err instanceof Error) {\n if (hasCause(err))\n messages.push(...trace(err.cause).split('\\n').map(s => ' ' + s));\n }\n else {\n messages.push(typeof err === 'string' ? err : JSON.stringify(err));\n }\n return messages.join('\\n');\n}\nfunction hasCause(x) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return !!x.cause;\n}\n/**\n * An IsoError with a module property.\n */\nexport class ModuleError extends IsoError {\n /**\n * @param module The module that defines this error.\n */\n constructor(module, message, options) {\n super(message, options);\n Object.defineProperty(this, \"module\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: module\n });\n }\n}\nexport function isAggregateError(error) {\n return error instanceof Error && Array.isArray(error.errors);\n}\n//# sourceMappingURL=index.js.map","export function mapKey(subject, predicate, thisArg) {\n return Object.keys(subject).map(predicate, thisArg);\n}\n//# sourceMappingURL=mapKey.js.map","/**\n * Creates a `Record<Key, Value>`\n */\nexport function record(value) {\n const r = Object.create(null);\n return (value ? Object.assign(r, value) : r);\n}\n//# sourceMappingURL=record.js.map","export function reduceByKey(subject, callbackfn, initialValue) {\n return Object.keys(subject).reduce(callbackfn, initialValue);\n}\n/**\n * @deprecated renamed to reduceByKey\n */\nexport const reduceKey = reduceByKey;\n//# sourceMappingURL=reduceKey.js.map","export function required(source1, source2, source3) {\n return merge([source1, source2, source3], (p, e) => {\n return { ...p, ...e };\n });\n}\nexport function requiredDeep(source1, source2, source3) {\n return merge([source1, source2, source3], (p, e) => deepmerge(p, e));\n}\nfunction merge(entries, reducer) {\n if (entries[0] === undefined || entries[0] === null)\n return entries[0];\n return entries.filter(x => !!x).reduce(reducer, {});\n}\nfunction deepmerge(source1, source2) {\n if (typeof source1 !== 'object' || source1 === null)\n return source2 !== undefined ? source2 : source1;\n if (Array.isArray(source1)) {\n if (Array.isArray(source2))\n return source2;\n if (source2 === undefined)\n return [...source1];\n return [...source1, source2];\n }\n return getAllKeys(source1).concat(getAllKeys(source2)).reduce((p, k) => {\n // @ts-ignore\n p[k] = deepmerge(source1[k], source2 && source2[k]);\n return p;\n }, {});\n}\nfunction getAllKeys(subject, internal = false) {\n if (typeof subject !== 'object')\n return [];\n const propertyNames = Object.getOwnPropertyNames(subject);\n const keys = internal ? propertyNames.filter(n => n !== 'constructor') : propertyNames;\n const proto = Object.getPrototypeOf(subject);\n return proto !== Object.prototype ? keys.concat(getAllKeys(proto, true)) : keys;\n}\nexport function unpartial(s1, s2, s3) {\n // defensive check for JS\n if (s1 === undefined || s1 === null)\n return s1;\n return [s1, s2, s3]\n .filter(notNil)\n .reduce((p, s) => ({ ...p, ...trimNilProps(s) }), {});\n}\nfunction trimNilProps(value) {\n return Object.keys(value).reduce((p, k) => {\n if (notNil(value[k]))\n p[k] = value[k];\n return p;\n }, {});\n}\nfunction notNil(value) {\n return value !== null && value !== undefined;\n}\nexport function unpartialRecursively(arg1, arg2, arg3) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n return requiredDeep(arg1, arg2, arg3);\n}\n//# sourceMappingURL=index.js.map","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export * from './console.js'\nexport * from './errors.js'\nexport * from './formatter.js'\nexport * from './logLevels.js'\nexport * from './memory.js'\nexport {\n configGlobal, createStandardLog, createStandardLogForTest,\n getLogger, suppressLogs\n} from './standardLog.js'\nexport type { StandardLog, StandardLogForTest, StandardLogInstance } from './standardLog.js'\nexport * from './types.js'\n"],"names":[],"sourceRoot":""}
Binary file
package/esm/errors.d.ts CHANGED
@@ -1,7 +1,13 @@
1
1
  import { IsoError, ModuleError } from 'iso-error';
2
+ /**
3
+ * @deprecated No longer used since 11.2.0
4
+ */
2
5
  export declare class StandardLogError extends ModuleError {
3
6
  constructor(description: string, options?: IsoError.Options);
4
7
  }
8
+ /**
9
+ * @deprecated no longer used since 11.2.0
10
+ */
5
11
  export declare class InvalidId extends StandardLogError {
6
12
  id: string;
7
13
  constructor(id: string, options?: IsoError.Options);
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../ts/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEjD,qBAAa,gBAAiB,SAAQ,WAAW;gBACnC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO;CAG5D;AACD,qBAAa,SAAU,SAAQ,gBAAgB;IAC1B,EAAE,EAAE,MAAM;gBAAV,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO;CAG1D"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../ts/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEjD;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;gBACnC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO;CAG5D;AAED;;GAEG;AACH,qBAAa,SAAU,SAAQ,gBAAgB;IAC1B,EAAE,EAAE,MAAM;gBAAV,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO;CAG1D"}
package/esm/errors.js CHANGED
@@ -1,9 +1,15 @@
1
1
  import { ModuleError } from 'iso-error';
2
+ /**
3
+ * @deprecated No longer used since 11.2.0
4
+ */
2
5
  export class StandardLogError extends ModuleError {
3
6
  constructor(description, options) {
4
7
  super('standard-log', description, options);
5
8
  }
6
9
  }
10
+ /**
11
+ * @deprecated no longer used since 11.2.0
12
+ */
7
13
  export class InvalidId extends StandardLogError {
8
14
  constructor(id, options) {
9
15
  super(`logger id only supports alphanumeric, unicode characters, and [:_-.]. Received ${id}`, options);
package/esm/errors.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../ts/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,WAAW,EAAE,MAAM,WAAW,CAAA;AAEjD,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IAC/C,YAAY,WAAmB,EAAE,OAA0B;QACzD,KAAK,CAAC,cAAc,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA;IAC7C,CAAC;CACF;AACD,MAAM,OAAO,SAAU,SAAQ,gBAAgB;IAC7C,YAAmB,EAAU,EAAE,OAA0B;QACvD,KAAK,CAAC,kFAAkF,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;;;;;mBADrF;;IAEnB,CAAC;CACF","sourcesContent":["import { IsoError, ModuleError } from 'iso-error'\n\nexport class StandardLogError extends ModuleError {\n constructor(description: string, options?: IsoError.Options) {\n super('standard-log', description, options)\n }\n}\nexport class InvalidId extends StandardLogError {\n constructor(public id: string, options?: IsoError.Options) {\n super(`logger id only supports alphanumeric, unicode characters, and [:_-.]. Received ${id}`, options)\n }\n}\n"]}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../ts/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,WAAW,EAAE,MAAM,WAAW,CAAA;AAEjD;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IAC/C,YAAY,WAAmB,EAAE,OAA0B;QACzD,KAAK,CAAC,cAAc,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA;IAC7C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,gBAAgB;IAC7C,YAAmB,EAAU,EAAE,OAA0B;QACvD,KAAK,CAAC,kFAAkF,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;;;;;mBADrF;;IAEnB,CAAC;CACF","sourcesContent":["import { IsoError, ModuleError } from 'iso-error'\n\n/**\n * @deprecated No longer used since 11.2.0\n */\nexport class StandardLogError extends ModuleError {\n constructor(description: string, options?: IsoError.Options) {\n super('standard-log', description, options)\n }\n}\n\n/**\n * @deprecated no longer used since 11.2.0\n */\nexport class InvalidId extends StandardLogError {\n constructor(public id: string, options?: IsoError.Options) {\n super(`logger id only supports alphanumeric, unicode characters, and [:_-.]. Received ${id}`, options)\n }\n}\n"]}
@@ -76,6 +76,6 @@ export declare function toLogLevelName(level: number): "emergency" | "alert" | "
76
76
  /**
77
77
  * Convert default log level name to log level value.
78
78
  */
79
- export declare function toLogLevel(name: string): any;
79
+ export declare function toLogLevel(name: string): number | undefined;
80
80
  export declare const DEFAULT_LOG_METHOD_NAMES: string[];
81
81
  //# sourceMappingURL=logLevels.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logLevels.d.ts","sourceRoot":"","sources":["../ts/logLevels.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,SAAS;IACpB;;OAEG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;;OAKG;;IAEH;;OAEG;;CAEJ,CAAA;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,4GAW3C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,OAEtC;AAED,eAAO,MAAM,wBAAwB,EAAE,MAAM,EAW5C,CAAA"}
1
+ {"version":3,"file":"logLevels.d.ts","sourceRoot":"","sources":["../ts/logLevels.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,SAAS;IACpB;;OAEG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;;OAKG;;IAEH;;OAEG;;CAEJ,CAAA;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,4GAW3C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE3D;AAED,eAAO,MAAM,wBAAwB,EAAE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AAY;IACrC,OAAQ,SAAiB,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAA;AACrD,CAAC;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAa;IAChD,WAAW;IACX,OAAO;IACP,UAAU;IACV,OAAO;IACP,MAAM;IACN,QAAQ;IACR,MAAM;IACN,OAAO;IACP,OAAO;IACP,QAAQ;CACT,CAAA","sourcesContent":["\nexport const logLevels = {\n /**\n * none: 0\n */\n none: 0 as const,\n /**\n * emergency: 100\n *\n * emergency -> alert\n */\n emergency: 100 as const,\n /**\n * alert: 200\n *\n * emergency -> alert -> critical\n */\n alert: 200 as const,\n /**\n * critical: 300\n *\n * alert -> critical -> error\n */\n critical: 300 as const,\n /**\n * error: 400\n *\n * critical -> error -> warn\n */\n error: 400 as const,\n /**\n * warn: 500\n *\n * error -> warn -> notice\n */\n warn: 500 as const,\n /**\n * notice: 600\n *\n * warn -> notice -> info\n */\n notice: 600 as const,\n /**\n * info: 700\n *\n * notice -> info -> debug\n */\n info: 700 as const,\n /**\n * debug: 800\n *\n * info -> debug -> trace\n */\n debug: 800 as const,\n /**\n * trace: 900\n *\n * debug -> trace -> planck\n */\n trace: 900 as const,\n /**\n * planck: Infinity\n * `planck unit` is a very small unit <https://en.wikipedia.org/wiki/Planck_units>.\n *\n * trace -> planck\n */\n planck: Infinity,\n /**\n * all: Infinity\n */\n all: Infinity\n}\n\n/**\n * Convert default log level value to log level name.\n */\nexport function toLogLevelName(level: number) {\n if (level <= 100) return 'emergency'\n if (level <= 200) return 'alert'\n if (level <= 300) return 'critical'\n if (level <= 400) return 'error'\n if (level <= 500) return 'warn'\n if (level <= 600) return 'notice'\n if (level <= 700) return 'info'\n if (level <= 800) return 'debug'\n if (level <= 900) return 'trace'\n return 'planck'\n}\n\n/**\n * Convert default log level name to log level value.\n */\nexport function toLogLevel(name: string) {\n return (logLevels as any)[name.toLocaleLowerCase()]\n}\n\nexport const DEFAULT_LOG_METHOD_NAMES: string[] = [\n 'emergency',\n 'alert',\n 'critical',\n 'error',\n 'warn',\n 'notice',\n 'info',\n 'debug',\n 'trace',\n 'planck'\n]\n"]}
1
+ {"version":3,"file":"logLevels.js","sourceRoot":"","sources":["../ts/logLevels.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;;OAEG;IACH,IAAI,EAAE,CAAU;IAChB;;;;OAIG;IACH,SAAS,EAAE,GAAY;IACvB;;;;OAIG;IACH,KAAK,EAAE,GAAY;IACnB;;;;OAIG;IACH,QAAQ,EAAE,GAAY;IACtB;;;;OAIG;IACH,KAAK,EAAE,GAAY;IACnB;;;;OAIG;IACH,IAAI,EAAE,GAAY;IAClB;;;;OAIG;IACH,MAAM,EAAE,GAAY;IACpB;;;;OAIG;IACH,IAAI,EAAE,GAAY;IAClB;;;;OAIG;IACH,KAAK,EAAE,GAAY;IACnB;;;;OAIG;IACH,KAAK,EAAE,GAAY;IACnB;;;;;OAKG;IACH,MAAM,EAAE,QAAQ;IAChB;;OAEG;IACH,GAAG,EAAE,QAAQ;CACd,CAAA;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,WAAW,CAAA;IACpC,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,OAAO,CAAA;IAChC,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,UAAU,CAAA;IACnC,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,OAAO,CAAA;IAChC,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,MAAM,CAAA;IAC/B,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,QAAQ,CAAA;IACjC,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,MAAM,CAAA;IAC/B,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,OAAO,CAAA;IAChC,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,OAAO,CAAA;IAChC,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAQ,SAAiB,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAA;AACrD,CAAC;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAa;IAChD,WAAW;IACX,OAAO;IACP,UAAU;IACV,OAAO;IACP,MAAM;IACN,QAAQ;IACR,MAAM;IACN,OAAO;IACP,OAAO;IACP,QAAQ;CACT,CAAA","sourcesContent":["\nexport const logLevels = {\n /**\n * none: 0\n */\n none: 0 as const,\n /**\n * emergency: 100\n *\n * emergency -> alert\n */\n emergency: 100 as const,\n /**\n * alert: 200\n *\n * emergency -> alert -> critical\n */\n alert: 200 as const,\n /**\n * critical: 300\n *\n * alert -> critical -> error\n */\n critical: 300 as const,\n /**\n * error: 400\n *\n * critical -> error -> warn\n */\n error: 400 as const,\n /**\n * warn: 500\n *\n * error -> warn -> notice\n */\n warn: 500 as const,\n /**\n * notice: 600\n *\n * warn -> notice -> info\n */\n notice: 600 as const,\n /**\n * info: 700\n *\n * notice -> info -> debug\n */\n info: 700 as const,\n /**\n * debug: 800\n *\n * info -> debug -> trace\n */\n debug: 800 as const,\n /**\n * trace: 900\n *\n * debug -> trace -> planck\n */\n trace: 900 as const,\n /**\n * planck: Infinity\n * `planck unit` is a very small unit <https://en.wikipedia.org/wiki/Planck_units>.\n *\n * trace -> planck\n */\n planck: Infinity,\n /**\n * all: Infinity\n */\n all: Infinity\n}\n\n/**\n * Convert default log level value to log level name.\n */\nexport function toLogLevelName(level: number) {\n if (level <= 100) return 'emergency'\n if (level <= 200) return 'alert'\n if (level <= 300) return 'critical'\n if (level <= 400) return 'error'\n if (level <= 500) return 'warn'\n if (level <= 600) return 'notice'\n if (level <= 700) return 'info'\n if (level <= 800) return 'debug'\n if (level <= 900) return 'trace'\n return 'planck'\n}\n\n/**\n * Convert default log level name to log level value.\n */\nexport function toLogLevel(name: string): number | undefined {\n return (logLevels as any)[name.toLocaleLowerCase()]\n}\n\nexport const DEFAULT_LOG_METHOD_NAMES: string[] = [\n 'emergency',\n 'alert',\n 'critical',\n 'error',\n 'warn',\n 'notice',\n 'info',\n 'debug',\n 'trace',\n 'planck'\n]\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=logLevels.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logLevels.spec.d.ts","sourceRoot":"","sources":["../ts/logLevels.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import { toLogLevel } from './logLevels.js';
2
+ describe(`${toLogLevel.name}()`, () => {
3
+ it('returns undefined if value is not a default log level name', () => {
4
+ const result = toLogLevel('unknown');
5
+ expect(result).toBeUndefined();
6
+ });
7
+ });
8
+ //# sourceMappingURL=logLevels.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logLevels.spec.js","sourceRoot":"","sources":["../ts/logLevels.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,QAAQ,CAAC,GAAG,UAAU,CAAC,IAAI,IAAI,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE;QACpE,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,CAAC,CAAA;QACpC,MAAM,CAAC,MAAM,CAAC,CAAC,aAAa,EAAE,CAAA;IAChC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { toLogLevel } from './logLevels.js'\n\ndescribe(`${toLogLevel.name}()`, () => {\n it('returns undefined if value is not a default log level name', () => {\n const result = toLogLevel('unknown')\n expect(result).toBeUndefined()\n })\n})\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../ts/logger.ts"],"names":[],"mappings":"AAGA,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,CAyD5B"}
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,CAyD5B"}
package/esm/logger.js CHANGED
@@ -1,8 +1,7 @@
1
- import { InvalidId } from './errors.js';
2
1
  import { logLevels } from './logLevels.js';
3
2
  export function createLogger(store, id, options) {
4
3
  var _a;
5
- validateId(id, options);
4
+ id = sanitizeId(id);
6
5
  const writeTo = (_a = options === null || options === void 0 ? void 0 : options.writeTo) !== null && _a !== void 0 ? _a : (() => true);
7
6
  const [filter, reporters] = typeof writeTo === 'string'
8
7
  ? [id => id === writeTo, store.reporters]
@@ -58,9 +57,8 @@ export function createLogger(store, id, options) {
58
57
  });
59
58
  return logger;
60
59
  }
61
- function validateId(id, meta) {
62
- if (/[`~!#$%^&*()=+[\]{},|<>?]/.test(id))
63
- throw new InvalidId(id, meta);
60
+ function sanitizeId(id) {
61
+ return id.replace(/[`~!#$%^&*()=+[\]{},|<>?]/g, '-');
64
62
  }
65
63
  function writeToReporters(reporters, logEntry, filter) {
66
64
  reporters.filter(r => filter(r.id)).forEach(r => r.write(logEntry));
package/esm/logger.js.map CHANGED
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C3E,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE;YAClC,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE;gBACxB,IAAI,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;oBAAE,KAAK,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC,CAAA;YAC9F,CAAC;SACF,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IACF,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAS,UAAU,CAAC,EAAU,EAAE,IAAqB;IACnD,IAAI,2BAA2B,CAAC,IAAI,CAAC,EAAE,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;AACzE,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 type { StackTraceMeta } from '@just-func/types'\nimport { InvalidId } from './errors.js'\nimport { 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 validateId(id, options)\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 const level = logLevels.debug\n if (shouldLog(store, level, logger.level))\n write({\n id,\n level,\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)\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 validateId(id: string, meta?: StackTraceMeta) {\n if (/[`~!#$%^&*()=+[\\]{},|<>?]/.test(id)) throw new InvalidId(id, meta)\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,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,OAAO,KAAK,QAAQ;QACvG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;QACzC,CAAC,CAAC,OAAO,YAAY,MAAM;YACzB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;YAC3C,CAAC,CAAC,OAAO,OAAO,KAAK,UAAU;gBAC7B,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;gBAC5B,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IAE/B,SAAS,KAAK,CAAC,KAAe;QAC5B,gBAAgB,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IAC5C,CAAC;IAED,MAAM,MAAM,GAAG;QACb,KAAK,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK;QACrB,KAAK;KACC,CAAA;IAER,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE;QAC9B,EAAE,EAAE,EAAE,KAAK,EAAE,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K,EAAE;QAC3E,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE;YAClC,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE;gBACxB,IAAI,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;oBAAE,KAAK,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC,CAAA;YAC9F,CAAC;SACF,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IACF,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAS,UAAU,CAAC,EAAU;IAC5B,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 const level = logLevels.debug\n if (shouldLog(store, level, logger.level))\n write({\n id,\n level,\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)\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,6 +1,7 @@
1
1
  import a from 'assertron';
2
2
  import { createMemoryLogReporter, logLevels } from './index.js';
3
3
  import { assertSSF, logEntriesToString } from './testUtil.js';
4
+ import { filename } from 'dirname-filename-esm';
4
5
  const mikuIsSinging = { id: 'test-log', level: logLevels.info, args: ['miku', 'is', 'singing'], timestamp: new Date() };
5
6
  const lukaIsDancing = { id: 'test-log', level: logLevels.warn, args: ['luka', 'is', 'dancing'], timestamp: new Date() };
6
7
  const reporter = createMemoryLogReporter();
@@ -8,7 +9,7 @@ describe(createMemoryLogReporter.name, () => {
8
9
  it('filter is readonly', () => {
9
10
  const reporter = createMemoryLogReporter();
10
11
  const err = a.throws(() => { reporter.filter = () => true; }, err => /only a getter/.test(err));
11
- assertSSF(err, __filename);
12
+ assertSSF(err, filename(import.meta));
12
13
  });
13
14
  test('log entries are saved in the `logs` property', () => {
14
15
  const reporter = createMemoryLogReporter();
@@ -1 +1 @@
1
- {"version":3,"file":"memory.spec.js","sourceRoot":"","sources":["../ts/memory.spec.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,WAAW,CAAA;AACzB,OAAO,EAAE,uBAAuB,EAAqC,SAAS,EAAE,MAAM,YAAY,CAAA;AAClG,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAE7D,MAAM,aAAa,GAAG,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAE,CAAA;AACvH,MAAM,aAAa,GAAG,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAE,CAAA;AACvH,MAAM,QAAQ,GAAG,uBAAuB,EAAE,CAAA;AAE1C,QAAQ,CAAC,uBAAuB,C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A;IACxB,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAC5B,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;QACnC,MAAM,MAAM,GAAG,kBAAkB,CAAC;YAChC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE;SACvE,CAAC,CAAA;QAEF,MAAM,GAAG,GAAG,SAAS,CAAC,WAAW,EAAE,CAAA;QACnC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,GAAG,wBAAwB,CAAC,CAAA;IACxD,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC3B,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;QACnC,MAAM,MAAM,GAAG,kBAAkB,CAAC;YAChC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE;SACxE,CAAC,CAAA;QAEF,MAAM,GAAG,GAAG,SAAS,CAAC,WAAW,EAAE,CAAA;QACnC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,GAAG,2BAA2B,CAAC,CAAA;IAC3D,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import a from 'assertron'\nimport { createMemoryLogReporter, LogEntry, LogFilter, LogFormatter, logLevels } from './index.js'\nimport { assertSSF, logEntriesToString } from './testUtil.js'\n\nconst mikuIsSinging = { id: 'test-log', level: logLevels.info, args: ['miku', 'is', 'singing'], timestamp: new Date() }\nconst lukaIsDancing = { id: 'test-log', level: logLevels.warn, args: ['luka', 'is', 'dancing'], timestamp: new Date() }\nconst reporter = createMemoryLogReporter()\n\ndescribe(createMemoryLogReporter.name, () => {\n it('filter is readonly', () => {\n const reporter = createMemoryLogReporter()\n const err = a.throws(() => { (reporter as any).filter = () => true }, err => /only a getter/.test(err))\n\n assertSSF(err, __filename)\n })\n\n test('log entries are saved in the `logs` property', () => {\n const reporter = createMemoryLogReporter()\n const entry = { id: 'log', level: 1, args: ['some messages'], timestamp: new Date() }\n reporter.write(entry)\n expect(reporter.logs).toEqual([entry])\n })\n\n test('can override id', () => {\n const reporter = createMemoryLogReporter({ id: 'custom-id-mem' })\n expect(reporter.id).toBe('custom-id-mem')\n })\n\n test('can filter', () => {\n const filter: LogFilter = (entry) => entry.id !== 'secret'\n const reporter = createMemoryLogReporter({ filter })\n expect(reporter.filter).toBe(filter)\n reporter.write({ id: 'ok', level: 1, args: ['some messages'], timestamp: new Date() })\n reporter.write({ id: 'secret', level: 1, args: ['some messages'], timestamp: new Date() })\n expect(reporter.logs.length).toBe(1)\n })\n\n test('formatter can be used to pre-process the log', () => {\n const formatter: LogFormatter<LogEntry> = (entry) => ({\n ...entry,\n args: entry.args.map(arg => arg === 'secret' ? '<censored>' : arg)\n })\n const reporter = createMemoryLogReporter({ formatter })\n expect(reporter.formatter).toBe(formatter)\n\n const entry = { id: 'log', level: 1, args: ['a', 'secret', 'b'], timestamp: new Date() }\n reporter.write(entry)\n\n expect(reporter.logs[0].args[1]).toBe('<censored>')\n })\n\n describe(reporter.getLogMessages.name, () => {\n it('maps each log entries to string', () => {\n const r = createMemoryLogReporter()\n r.write(mikuIsSinging)\n r.write(lukaIsDancing)\n expect(r.getLogMessages()).toEqual([\n 'miku is singing',\n 'luka is dancing'\n ])\n })\n })\n\n describe(reporter.getLogMessage.name, () => {\n test('empty logs returns empty string', () => {\n const reporter = createMemoryLogReporter()\n\n expect(reporter.getLogMessage()).toEqual('')\n })\n\n test('print args', () => {\n const reporter = createMemoryLogReporter()\n const entry = { id: 'log', level: 1, args: ['miku', 'is', 'singing'], timestamp: new Date() }\n reporter.write(entry)\n expect(reporter.getLogMessage()).toEqual('miku is singing')\n })\n\n test('print object arg', () => {\n const reporter = createMemoryLogReporter()\n const entry = { id: 'log', level: 1, args: [{ 'miku': 'sing' }], timestamp: new Date() }\n reporter.write(entry)\n expect(reporter.getLogMessage()).toEqual(\"{ miku: 'sing' }\")\n })\n })\n\n describe(reporter.getLogMessageWithLevel.name, () => {\n test('print with level', () => {\n const reporter = createMemoryLogReporter()\n reporter.write({ id: 'log', level: logLevels.info, args: ['msg 1'], timestamp: new Date() })\n reporter.write({ id: 'log', level: logLevels.warn, args: ['msg 2'], timestamp: new Date() })\n expect(reporter.getLogMessageWithLevel()).toEqual(`(INFO) msg 1\\n(WARN) msg 2`)\n })\n })\n\n describe(reporter.getLogMessagesWithIdAndLevel.name, () => {\n it('does what the name says', () => {\n const r = createMemoryLogReporter()\n r.write(mikuIsSinging)\n r.write(lukaIsDancing)\n expect(r.getLogMessagesWithIdAndLevel()).toEqual([\n 'test-log (INFO) miku is singing',\n 'test-log (WARN) luka is dancing'\n ])\n })\n })\n\n describe(reporter.emit.name, () => {\n it('emit saved logs to console', () => {\n const r = createMemoryLogReporter()\n r.write(mikuIsSinging)\n r.write(lukaIsDancing)\n r.write({ id: 'test-log', level: logLevels.info, args: ['the two messages above are expected'], timestamp: new Date() })\n\n // inspect visually\n r.emit()\n })\n })\n})\n\ndescribe(logEntriesToString.name, () => {\n test('convert log entries to string', () => {\n const timestamp = new Date(2019, 6)\n const actual = logEntriesToString([\n { id: 'log', level: logLevels.emergency, args: ['emergency'], timestamp },\n { id: 'log', level: logLevels.critical, args: ['critical'], timestamp },\n { id: 'log', level: logLevels.alert, args: ['alert'], timestamp },\n { id: 'log', level: logLevels.error, args: ['error'], timestamp },\n { id: 'log', level: logLevels.warn, args: ['warn'], timestamp },\n { id: 'log', level: logLevels.notice, args: ['notice'], timestamp },\n { id: 'log', level: logLevels.info, args: ['info'], timestamp },\n { id: 'log', level: logLevels.debug, args: ['debug'], timestamp },\n { id: 'log', level: logLevels.trace, args: ['trace'], timestamp }\n ])\n\n const iso = timestamp.toISOString()\n expect(actual).toEqual(`${iso},log,(EMERGENCY),emergency\n${iso},log,(CRITICAL),critical\n${iso},log,(ALERT),alert\n${iso},log,(ERROR),error\n${iso},log,(WARN),warn\n${iso},log,(NOTICE),notice\n${iso},log,(INFO),info\n${iso},log,(DEBUG),debug\n${iso},log,(TRACE),trace`)\n })\n\n test('print out object', () => {\n const timestamp = new Date(2021, 4)\n const actual = logEntriesToString([\n { id: 'log', level: logLevels.info, args: ['a', { a: 1 }], timestamp }\n ])\n\n const iso = timestamp.toISOString()\n expect(actual).toEqual(`${iso},log,(INFO),a,{ a: 1 }`)\n })\n\n test('print out array', () => {\n const timestamp = new Date(2021, 4)\n const actual = logEntriesToString([\n { id: 'log', level: logLevels.info, args: ['a', [1, 2, 3]], timestamp }\n ])\n\n const iso = timestamp.toISOString()\n expect(actual).toEqual(`${iso},log,(INFO),a,[ 1, 2, 3 ]`)\n })\n})\n"]}
1
+ {"version":3,"file":"memory.spec.js","sourceRoot":"","sources":["../ts/memory.spec.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,WAAW,CAAA;AACzB,OAAO,EAAE,uBAAuB,EAAqC,SAAS,EAAE,MAAM,YAAY,CAAA;AAClG,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAE/C,MAAM,aAAa,GAAG,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAE,CAAA;AACvH,MAAM,aAAa,GAAG,EAAE,EAAE,EAAE,UAAU,EA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AC,CAAA;IAC3D,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import a from 'assertron'\nimport { createMemoryLogReporter, LogEntry, LogFilter, LogFormatter, logLevels } from './index.js'\nimport { assertSSF, logEntriesToString } from './testUtil.js'\nimport { filename } from 'dirname-filename-esm'\n\nconst mikuIsSinging = { id: 'test-log', level: logLevels.info, args: ['miku', 'is', 'singing'], timestamp: new Date() }\nconst lukaIsDancing = { id: 'test-log', level: logLevels.warn, args: ['luka', 'is', 'dancing'], timestamp: new Date() }\nconst reporter = createMemoryLogReporter()\n\ndescribe(createMemoryLogReporter.name, () => {\n it('filter is readonly', () => {\n const reporter = createMemoryLogReporter()\n const err = a.throws(() => { (reporter as any).filter = () => true }, err => /only a getter/.test(err))\n\n assertSSF(err, filename(import.meta))\n })\n\n test('log entries are saved in the `logs` property', () => {\n const reporter = createMemoryLogReporter()\n const entry = { id: 'log', level: 1, args: ['some messages'], timestamp: new Date() }\n reporter.write(entry)\n expect(reporter.logs).toEqual([entry])\n })\n\n test('can override id', () => {\n const reporter = createMemoryLogReporter({ id: 'custom-id-mem' })\n expect(reporter.id).toBe('custom-id-mem')\n })\n\n test('can filter', () => {\n const filter: LogFilter = (entry) => entry.id !== 'secret'\n const reporter = createMemoryLogReporter({ filter })\n expect(reporter.filter).toBe(filter)\n reporter.write({ id: 'ok', level: 1, args: ['some messages'], timestamp: new Date() })\n reporter.write({ id: 'secret', level: 1, args: ['some messages'], timestamp: new Date() })\n expect(reporter.logs.length).toBe(1)\n })\n\n test('formatter can be used to pre-process the log', () => {\n const formatter: LogFormatter<LogEntry> = (entry) => ({\n ...entry,\n args: entry.args.map(arg => arg === 'secret' ? '<censored>' : arg)\n })\n const reporter = createMemoryLogReporter({ formatter })\n expect(reporter.formatter).toBe(formatter)\n\n const entry = { id: 'log', level: 1, args: ['a', 'secret', 'b'], timestamp: new Date() }\n reporter.write(entry)\n\n expect(reporter.logs[0].args[1]).toBe('<censored>')\n })\n\n describe(reporter.getLogMessages.name, () => {\n it('maps each log entries to string', () => {\n const r = createMemoryLogReporter()\n r.write(mikuIsSinging)\n r.write(lukaIsDancing)\n expect(r.getLogMessages()).toEqual([\n 'miku is singing',\n 'luka is dancing'\n ])\n })\n })\n\n describe(reporter.getLogMessage.name, () => {\n test('empty logs returns empty string', () => {\n const reporter = createMemoryLogReporter()\n\n expect(reporter.getLogMessage()).toEqual('')\n })\n\n test('print args', () => {\n const reporter = createMemoryLogReporter()\n const entry = { id: 'log', level: 1, args: ['miku', 'is', 'singing'], timestamp: new Date() }\n reporter.write(entry)\n expect(reporter.getLogMessage()).toEqual('miku is singing')\n })\n\n test('print object arg', () => {\n const reporter = createMemoryLogReporter()\n const entry = { id: 'log', level: 1, args: [{ 'miku': 'sing' }], timestamp: new Date() }\n reporter.write(entry)\n expect(reporter.getLogMessage()).toEqual(\"{ miku: 'sing' }\")\n })\n })\n\n describe(reporter.getLogMessageWithLevel.name, () => {\n test('print with level', () => {\n const reporter = createMemoryLogReporter()\n reporter.write({ id: 'log', level: logLevels.info, args: ['msg 1'], timestamp: new Date() })\n reporter.write({ id: 'log', level: logLevels.warn, args: ['msg 2'], timestamp: new Date() })\n expect(reporter.getLogMessageWithLevel()).toEqual(`(INFO) msg 1\\n(WARN) msg 2`)\n })\n })\n\n describe(reporter.getLogMessagesWithIdAndLevel.name, () => {\n it('does what the name says', () => {\n const r = createMemoryLogReporter()\n r.write(mikuIsSinging)\n r.write(lukaIsDancing)\n expect(r.getLogMessagesWithIdAndLevel()).toEqual([\n 'test-log (INFO) miku is singing',\n 'test-log (WARN) luka is dancing'\n ])\n })\n })\n\n describe(reporter.emit.name, () => {\n it('emit saved logs to console', () => {\n const r = createMemoryLogReporter()\n r.write(mikuIsSinging)\n r.write(lukaIsDancing)\n r.write({ id: 'test-log', level: logLevels.info, args: ['the two messages above are expected'], timestamp: new Date() })\n\n // inspect visually\n r.emit()\n })\n })\n})\n\ndescribe(logEntriesToString.name, () => {\n test('convert log entries to string', () => {\n const timestamp = new Date(2019, 6)\n const actual = logEntriesToString([\n { id: 'log', level: logLevels.emergency, args: ['emergency'], timestamp },\n { id: 'log', level: logLevels.critical, args: ['critical'], timestamp },\n { id: 'log', level: logLevels.alert, args: ['alert'], timestamp },\n { id: 'log', level: logLevels.error, args: ['error'], timestamp },\n { id: 'log', level: logLevels.warn, args: ['warn'], timestamp },\n { id: 'log', level: logLevels.notice, args: ['notice'], timestamp },\n { id: 'log', level: logLevels.info, args: ['info'], timestamp },\n { id: 'log', level: logLevels.debug, args: ['debug'], timestamp },\n { id: 'log', level: logLevels.trace, args: ['trace'], timestamp }\n ])\n\n const iso = timestamp.toISOString()\n expect(actual).toEqual(`${iso},log,(EMERGENCY),emergency\n${iso},log,(CRITICAL),critical\n${iso},log,(ALERT),alert\n${iso},log,(ERROR),error\n${iso},log,(WARN),warn\n${iso},log,(NOTICE),notice\n${iso},log,(INFO),info\n${iso},log,(DEBUG),debug\n${iso},log,(TRACE),trace`)\n })\n\n test('print out object', () => {\n const timestamp = new Date(2021, 4)\n const actual = logEntriesToString([\n { id: 'log', level: logLevels.info, args: ['a', { a: 1 }], timestamp }\n ])\n\n const iso = timestamp.toISOString()\n expect(actual).toEqual(`${iso},log,(INFO),a,{ a: 1 }`)\n })\n\n test('print out array', () => {\n const timestamp = new Date(2021, 4)\n const actual = logEntriesToString([\n { id: 'log', level: logLevels.info, args: ['a', [1, 2, 3]], timestamp }\n ])\n\n const iso = timestamp.toISOString()\n expect(actual).toEqual(`${iso},log,(INFO),a,[ 1, 2, 3 ]`)\n })\n})\n"]}