standard-log 11.5.1 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -3
- package/cjs/console.d.ts +3 -3
- package/cjs/console.d.ts.map +1 -1
- package/cjs/console.js +18 -9
- package/cjs/console.js.map +1 -1
- package/cjs/errors.d.ts.map +1 -1
- package/cjs/errors.js.map +1 -1
- package/cjs/formatter.d.ts +1 -1
- package/cjs/formatter.d.ts.map +1 -1
- package/cjs/formatter.js +2 -2
- package/cjs/formatter.js.map +1 -1
- package/cjs/index.d.ts +4 -4
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +7 -8
- package/cjs/index.js.map +1 -1
- package/cjs/{logLevels.d.ts → log_levels.d.ts} +1 -1
- package/cjs/log_levels.d.ts.map +1 -0
- package/cjs/{logLevels.js → log_levels.js} +1 -1
- package/cjs/log_levels.js.map +1 -0
- package/{esm/logStore.d.ts → cjs/log_store.d.ts} +1 -1
- package/cjs/log_store.d.ts.map +1 -0
- package/cjs/{logStore.js → log_store.js} +6 -6
- package/cjs/log_store.js.map +1 -0
- package/cjs/logger.d.ts +1 -1
- package/cjs/logger.d.ts.map +1 -1
- package/cjs/logger.js +16 -14
- package/cjs/logger.js.map +1 -1
- package/cjs/memory.d.ts +2 -2
- package/cjs/memory.d.ts.map +1 -1
- package/cjs/memory.js +15 -8
- package/cjs/memory.js.map +1 -1
- package/cjs/platform.d.ts.map +1 -1
- package/cjs/platform.js +1 -2
- package/cjs/platform.js.map +1 -1
- package/cjs/{standardLog.ctx.d.ts → standard_log.ctx.d.ts} +2 -2
- package/cjs/standard_log.ctx.d.ts.map +1 -0
- package/cjs/{standardLog.ctx.js → standard_log.ctx.js} +1 -1
- package/cjs/standard_log.ctx.js.map +1 -0
- package/{esm/standardLog.d.ts → cjs/standard_log.d.ts} +4 -9
- package/cjs/standard_log.d.ts.map +1 -0
- package/cjs/{standardLog.js → standard_log.js} +37 -40
- package/cjs/standard_log.js.map +1 -0
- package/cjs/standard_log.mocks.d.ts +8 -0
- package/cjs/standard_log.mocks.d.ts.map +1 -0
- package/cjs/standard_log.mocks.js +32 -0
- package/cjs/standard_log.mocks.js.map +1 -0
- package/cjs/test_utils.d.ts +10 -0
- package/cjs/test_utils.d.ts.map +1 -0
- package/cjs/test_utils.js +25 -0
- package/cjs/test_utils.js.map +1 -0
- package/cjs/testing/index.d.ts +2 -0
- package/cjs/testing/index.d.ts.map +1 -0
- package/cjs/testing/index.js +6 -0
- package/cjs/testing/index.js.map +1 -0
- package/cjs/types.d.ts +12 -12
- package/cjs/types.d.ts.map +1 -1
- package/cjs/types.js.map +1 -1
- package/dist/standard-log.es5.js +1139 -758
- package/dist/standard-log.es5.js.gz +0 -0
- package/dist/standard-log.es5.js.map +1 -1
- package/dist/standard-log.es5.js.map.gz +0 -0
- package/dist/standard-log.esm.js +220 -175
- package/dist/standard-log.esm.js.gz +0 -0
- package/dist/standard-log.esm.js.map +1 -1
- package/dist/standard-log.esm.js.map.gz +0 -0
- package/esm/console.d.ts +3 -3
- package/esm/console.d.ts.map +1 -1
- package/esm/console.js +21 -10
- package/esm/console.js.map +1 -1
- package/esm/errors.d.ts.map +1 -1
- package/esm/errors.js.map +1 -1
- package/esm/formatter.d.ts +1 -1
- package/esm/formatter.d.ts.map +1 -1
- package/esm/formatter.js +1 -1
- package/esm/formatter.js.map +1 -1
- package/esm/index.d.ts +4 -4
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +2 -2
- package/esm/index.js.map +1 -1
- package/esm/{logLevels.d.ts → log_levels.d.ts} +1 -1
- package/esm/log_levels.d.ts.map +1 -0
- package/esm/{logLevels.js → log_levels.js} +1 -1
- package/esm/log_levels.js.map +1 -0
- package/{cjs/logStore.d.ts → esm/log_store.d.ts} +1 -1
- package/esm/log_store.d.ts.map +1 -0
- package/esm/{logStore.js → log_store.js} +2 -2
- package/esm/log_store.js.map +1 -0
- package/esm/logger.d.ts +1 -1
- package/esm/logger.d.ts.map +1 -1
- package/esm/logger.js +2 -2
- package/esm/logger.js.map +1 -1
- package/esm/memory.d.ts +2 -2
- package/esm/memory.d.ts.map +1 -1
- package/esm/memory.js +15 -8
- package/esm/memory.js.map +1 -1
- package/esm/platform.d.ts.map +1 -1
- package/esm/platform.js +1 -2
- package/esm/platform.js.map +1 -1
- package/esm/{standardLog.ctx.d.ts → standard_log.ctx.d.ts} +2 -2
- package/esm/standard_log.ctx.d.ts.map +1 -0
- package/esm/{standardLog.ctx.js → standard_log.ctx.js} +1 -1
- package/esm/standard_log.ctx.js.map +1 -0
- package/{cjs/standardLog.d.ts → esm/standard_log.d.ts} +4 -9
- package/esm/standard_log.d.ts.map +1 -0
- package/esm/{standardLog.js → standard_log.js} +27 -28
- package/esm/standard_log.js.map +1 -0
- package/esm/standard_log.mocks.d.ts +8 -0
- package/esm/standard_log.mocks.d.ts.map +1 -0
- package/esm/standard_log.mocks.js +16 -0
- package/esm/standard_log.mocks.js.map +1 -0
- package/esm/test_utils.d.ts +10 -0
- package/esm/test_utils.d.ts.map +1 -0
- package/esm/test_utils.js +18 -0
- package/esm/test_utils.js.map +1 -0
- package/esm/testing/index.d.ts +2 -0
- package/esm/testing/index.d.ts.map +1 -0
- package/esm/testing/index.js +2 -0
- package/esm/testing/index.js.map +1 -0
- package/esm/types.d.ts +12 -12
- package/esm/types.d.ts.map +1 -1
- package/esm/types.js.map +1 -1
- package/package.json +14 -8
- package/ts/console.ts +55 -46
- package/ts/errors.ts +6 -6
- package/ts/formatter.ts +19 -19
- package/ts/index.ts +19 -10
- package/ts/log_levels.ts +107 -0
- package/ts/log_store.ts +63 -0
- package/ts/logger.ts +69 -59
- package/ts/memory.ts +66 -54
- package/ts/platform.ts +2 -2
- package/ts/standard_log.ctx.ts +8 -0
- package/ts/standard_log.mocks.ts +22 -0
- package/ts/standard_log.ts +140 -0
- package/ts/test_utils.ts +21 -0
- package/ts/testing/index.ts +1 -0
- package/ts/types.ts +72 -62
- package/cjs/logLevels.d.ts.map +0 -1
- package/cjs/logLevels.js.map +0 -1
- package/cjs/logStore.d.ts.map +0 -1
- package/cjs/logStore.js.map +0 -1
- package/cjs/standardLog.ctx.d.ts.map +0 -1
- package/cjs/standardLog.ctx.js.map +0 -1
- package/cjs/standardLog.d.ts.map +0 -1
- package/cjs/standardLog.js.map +0 -1
- package/esm/logLevels.d.ts.map +0 -1
- package/esm/logLevels.js.map +0 -1
- package/esm/logStore.d.ts.map +0 -1
- package/esm/logStore.js.map +0 -1
- package/esm/standardLog.ctx.d.ts.map +0 -1
- package/esm/standardLog.ctx.js.map +0 -1
- package/esm/standardLog.d.ts.map +0 -1
- package/esm/standardLog.js.map +0 -1
- package/ts/logLevels.ts +0 -108
- package/ts/logStore.ts +0 -54
- package/ts/standardLog.ctx.ts +0 -8
- package/ts/standardLog.ts +0 -135
package/dist/standard-log.esm.js
CHANGED
|
@@ -188,7 +188,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
188
188
|
/* harmony export */ });
|
|
189
189
|
/* harmony import */ var type_plus__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! type-plus */ "../../node_modules/.pnpm/unpartial@1.0.4/node_modules/unpartial/esm/index.js");
|
|
190
190
|
/* harmony import */ var _formatter_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./formatter.js */ "./ts/formatter.ts");
|
|
191
|
-
/* harmony import */ var
|
|
191
|
+
/* harmony import */ var _log_levels_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./log_levels.js */ "./ts/log_levels.ts");
|
|
192
192
|
/* harmony import */ var _platform_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./platform.js */ "./ts/platform.browser.ts");
|
|
193
193
|
|
|
194
194
|
|
|
@@ -197,11 +197,16 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
197
197
|
function toConsoleMethod(level) {
|
|
198
198
|
switch (true) {
|
|
199
199
|
// edge case in case none is somehow written
|
|
200
|
-
case
|
|
201
|
-
|
|
202
|
-
case
|
|
203
|
-
|
|
204
|
-
|
|
200
|
+
case level <= 0:
|
|
201
|
+
return 'debug';
|
|
202
|
+
case level <= _log_levels_js__WEBPACK_IMPORTED_MODULE_0__.logLevels.error:
|
|
203
|
+
return 'error';
|
|
204
|
+
case level <= _log_levels_js__WEBPACK_IMPORTED_MODULE_0__.logLevels.warn:
|
|
205
|
+
return 'warn';
|
|
206
|
+
case level <= _log_levels_js__WEBPACK_IMPORTED_MODULE_0__.logLevels.info:
|
|
207
|
+
return 'info';
|
|
208
|
+
default:
|
|
209
|
+
return 'debug';
|
|
205
210
|
}
|
|
206
211
|
}
|
|
207
212
|
// istanbul ignore next
|
|
@@ -224,13 +229,15 @@ function buildPolyfillConsole() {
|
|
|
224
229
|
debug: buildFn(typeof console.debug === 'function' ? 'debug' : 'log'),
|
|
225
230
|
info: buildFn(typeof console.info === 'function' ? 'info' : 'log'),
|
|
226
231
|
warn: buildFn(typeof console.warn === 'function' ? 'warn' : 'log'),
|
|
227
|
-
error: buildFn(typeof console.error === 'function' ? 'error' : 'log')
|
|
232
|
+
error: buildFn(typeof console.error === 'function' ? 'error' : 'log')
|
|
228
233
|
};
|
|
229
234
|
}
|
|
230
235
|
}
|
|
231
236
|
// istanbul ignore next
|
|
232
237
|
function buildFn(name) {
|
|
233
|
-
return function (...args) {
|
|
238
|
+
return function (...args) {
|
|
239
|
+
console[name](...args);
|
|
240
|
+
};
|
|
234
241
|
}
|
|
235
242
|
function createConsoleLogReporter(options) {
|
|
236
243
|
const { id, formatter, filter } = (0,type_plus__WEBPACK_IMPORTED_MODULE_1__.unpartial)({ id: 'console', formatter: _formatter_js__WEBPACK_IMPORTED_MODULE_2__.consoleFormatter }, options);
|
|
@@ -239,8 +246,12 @@ function createConsoleLogReporter(options) {
|
|
|
239
246
|
return Object.freeze({
|
|
240
247
|
id,
|
|
241
248
|
isConsoleReporter: true,
|
|
242
|
-
get formatter() {
|
|
243
|
-
|
|
249
|
+
get formatter() {
|
|
250
|
+
return formatter;
|
|
251
|
+
},
|
|
252
|
+
get filter() {
|
|
253
|
+
return filter;
|
|
254
|
+
},
|
|
244
255
|
console: _platform_js__WEBPACK_IMPORTED_MODULE_3__.polyfill.console,
|
|
245
256
|
write(entry) {
|
|
246
257
|
if (filter && !filter(entry))
|
|
@@ -267,7 +278,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
267
278
|
/* harmony export */ "InvalidId": function() { return /* binding */ InvalidId; },
|
|
268
279
|
/* harmony export */ "StandardLogError": function() { return /* binding */ StandardLogError; }
|
|
269
280
|
/* harmony export */ });
|
|
270
|
-
/* harmony import */ var iso_error__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! iso-error */ "../../node_modules/.pnpm/iso-error@
|
|
281
|
+
/* harmony import */ var iso_error__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! iso-error */ "../../node_modules/.pnpm/iso-error@6.0.1/node_modules/iso-error/esm/index.js");
|
|
271
282
|
|
|
272
283
|
/**
|
|
273
284
|
* @deprecated No longer used since 11.2.0
|
|
@@ -312,7 +323,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
312
323
|
/* harmony import */ var ms__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ms */ "../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js");
|
|
313
324
|
/* harmony import */ var ms__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(ms__WEBPACK_IMPORTED_MODULE_0__);
|
|
314
325
|
/* harmony import */ var upper_case__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! upper-case */ "../../node_modules/.pnpm/upper-case@2.0.2/node_modules/upper-case/dist/index.js");
|
|
315
|
-
/* harmony import */ var
|
|
326
|
+
/* harmony import */ var _log_levels_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./log_levels.js */ "./ts/log_levels.ts");
|
|
316
327
|
|
|
317
328
|
|
|
318
329
|
|
|
@@ -334,7 +345,7 @@ function createTimestampFormatter(format) {
|
|
|
334
345
|
}
|
|
335
346
|
}
|
|
336
347
|
function formatLogLevel(level) {
|
|
337
|
-
return `(${(0,upper_case__WEBPACK_IMPORTED_MODULE_1__.upperCase)((0,
|
|
348
|
+
return `(${(0,upper_case__WEBPACK_IMPORTED_MODULE_1__.upperCase)((0,_log_levels_js__WEBPACK_IMPORTED_MODULE_2__.toLogLevelName)(level))})`;
|
|
338
349
|
}
|
|
339
350
|
/**
|
|
340
351
|
* Formats log entry as plain text with the following format:
|
|
@@ -355,10 +366,10 @@ function consoleFormatter({ args }) {
|
|
|
355
366
|
|
|
356
367
|
/***/ }),
|
|
357
368
|
|
|
358
|
-
/***/ "./ts/
|
|
359
|
-
|
|
360
|
-
!*** ./ts/
|
|
361
|
-
|
|
369
|
+
/***/ "./ts/log_levels.ts":
|
|
370
|
+
/*!**************************!*\
|
|
371
|
+
!*** ./ts/log_levels.ts ***!
|
|
372
|
+
\**************************/
|
|
362
373
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
363
374
|
|
|
364
375
|
"use strict";
|
|
@@ -486,10 +497,10 @@ const DEFAULT_LOG_METHOD_NAMES = [
|
|
|
486
497
|
|
|
487
498
|
/***/ }),
|
|
488
499
|
|
|
489
|
-
/***/ "./ts/
|
|
490
|
-
|
|
491
|
-
!*** ./ts/
|
|
492
|
-
|
|
500
|
+
/***/ "./ts/log_store.ts":
|
|
501
|
+
/*!*************************!*\
|
|
502
|
+
!*** ./ts/log_store.ts ***!
|
|
503
|
+
\*************************/
|
|
493
504
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
494
505
|
|
|
495
506
|
"use strict";
|
|
@@ -498,11 +509,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
498
509
|
/* harmony export */ "createLogStore": function() { return /* binding */ createLogStore; },
|
|
499
510
|
/* harmony export */ "logLevelStore": function() { return /* binding */ logLevelStore; }
|
|
500
511
|
/* harmony export */ });
|
|
501
|
-
/* harmony import */ var type_plus__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! type-plus */ "../../node_modules/.pnpm/type-plus@5.0
|
|
502
|
-
/* harmony import */ var type_plus__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! type-plus */ "../../node_modules/.pnpm/type-plus@5.0
|
|
503
|
-
/* harmony import */ var type_plus__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! type-plus */ "../../node_modules/.pnpm/type-plus@5.0
|
|
512
|
+
/* harmony import */ var type_plus__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! type-plus */ "../../node_modules/.pnpm/type-plus@6.5.0/node_modules/type-plus/esm/object/record.js");
|
|
513
|
+
/* harmony import */ var type_plus__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! type-plus */ "../../node_modules/.pnpm/type-plus@6.5.0/node_modules/type-plus/esm/object/reduceKey.js");
|
|
514
|
+
/* harmony import */ var type_plus__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! type-plus */ "../../node_modules/.pnpm/type-plus@6.5.0/node_modules/type-plus/esm/object/mapKey.js");
|
|
504
515
|
/* harmony import */ var _console_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./console.js */ "./ts/console.ts");
|
|
505
|
-
/* harmony import */ var
|
|
516
|
+
/* harmony import */ var _log_levels_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./log_levels.js */ "./ts/log_levels.ts");
|
|
506
517
|
|
|
507
518
|
|
|
508
519
|
|
|
@@ -527,16 +538,16 @@ function logLevelStore(options) {
|
|
|
527
538
|
return {
|
|
528
539
|
getName(level) {
|
|
529
540
|
var _a;
|
|
530
|
-
return (_a = store.customLevelsReverse[level]) !== null && _a !== void 0 ? _a : (0,
|
|
541
|
+
return (_a = store.customLevelsReverse[level]) !== null && _a !== void 0 ? _a : (0,_log_levels_js__WEBPACK_IMPORTED_MODULE_3__.toLogLevelName)(level);
|
|
531
542
|
},
|
|
532
543
|
getLevel(name) {
|
|
533
544
|
var _a;
|
|
534
|
-
return (_a = store.customLevels[name]) !== null && _a !== void 0 ? _a : (0,
|
|
545
|
+
return (_a = store.customLevels[name]) !== null && _a !== void 0 ? _a : (0,_log_levels_js__WEBPACK_IMPORTED_MODULE_3__.toLogLevel)(name);
|
|
535
546
|
},
|
|
536
547
|
getAllLevels() {
|
|
537
|
-
return (0,type_plus__WEBPACK_IMPORTED_MODULE_2__.reduceKey)(
|
|
548
|
+
return (0,type_plus__WEBPACK_IMPORTED_MODULE_2__.reduceKey)(_log_levels_js__WEBPACK_IMPORTED_MODULE_3__.logLevels, (result, name) => {
|
|
538
549
|
if (name !== 'none' && name !== 'all')
|
|
539
|
-
result.push({ name, level:
|
|
550
|
+
result.push({ name, level: _log_levels_js__WEBPACK_IMPORTED_MODULE_3__.logLevels[name] });
|
|
540
551
|
return result;
|
|
541
552
|
}, (0,type_plus__WEBPACK_IMPORTED_MODULE_4__.mapKey)(store.customLevels, name => ({ name, level: store.customLevels[name] })));
|
|
542
553
|
}
|
|
@@ -557,7 +568,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
557
568
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
558
569
|
/* harmony export */ "createLogger": function() { return /* binding */ createLogger; }
|
|
559
570
|
/* harmony export */ });
|
|
560
|
-
/* harmony import */ var
|
|
571
|
+
/* harmony import */ var _log_levels_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./log_levels.js */ "./ts/log_levels.ts");
|
|
561
572
|
|
|
562
573
|
function createLogger(store, id, options) {
|
|
563
574
|
var _a;
|
|
@@ -581,11 +592,11 @@ function createLogger(store, id, options) {
|
|
|
581
592
|
id: { value: id, writable: false },
|
|
582
593
|
count: {
|
|
583
594
|
writable: false,
|
|
584
|
-
value: (
|
|
585
|
-
if (shouldLog(store,
|
|
595
|
+
value: (counter => (...args) => {
|
|
596
|
+
if (shouldLog(store, _log_levels_js__WEBPACK_IMPORTED_MODULE_0__.logLevels.debug, logger.level))
|
|
586
597
|
write({
|
|
587
598
|
id,
|
|
588
|
-
level:
|
|
599
|
+
level: _log_levels_js__WEBPACK_IMPORTED_MODULE_0__.logLevels.debug,
|
|
589
600
|
args: [++counter, ...args],
|
|
590
601
|
timestamp: new Date()
|
|
591
602
|
});
|
|
@@ -657,13 +668,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
657
668
|
|
|
658
669
|
|
|
659
670
|
function toMessageWithLevel(logs) {
|
|
660
|
-
return logs
|
|
671
|
+
return (logs
|
|
672
|
+
.map(_platform_js__WEBPACK_IMPORTED_MODULE_0__.toInspectLogEntry)
|
|
661
673
|
.map(log => `${(0,_formatter_js__WEBPACK_IMPORTED_MODULE_1__.formatLogLevel)(log.level)} ${log.args.join(' ')}`)
|
|
662
674
|
.join('\n')
|
|
663
675
|
// if it has more than this log,
|
|
664
676
|
// we assume it is running under tests,
|
|
665
677
|
// and remove this log to simplify testing.
|
|
666
|
-
.replace(/^\(WARN\) already configured for test, ignoring config\(\) call\n/, '');
|
|
678
|
+
.replace(/^\(WARN\) already configured for test, ignoring config\(\) call\n/, ''));
|
|
667
679
|
}
|
|
668
680
|
function createMemoryLogReporter(options) {
|
|
669
681
|
return Object.freeze(buildMemoryReporter((0,type_plus__WEBPACK_IMPORTED_MODULE_2__.unpartial)({ id: 'memory' }, options)));
|
|
@@ -673,8 +685,12 @@ function buildMemoryReporter(options) {
|
|
|
673
685
|
const logs = [];
|
|
674
686
|
return {
|
|
675
687
|
id,
|
|
676
|
-
get formatter() {
|
|
677
|
-
|
|
688
|
+
get formatter() {
|
|
689
|
+
return formatter;
|
|
690
|
+
},
|
|
691
|
+
get filter() {
|
|
692
|
+
return filter;
|
|
693
|
+
},
|
|
678
694
|
logs,
|
|
679
695
|
write(entry) {
|
|
680
696
|
if (filter && !filter(entry))
|
|
@@ -685,14 +701,16 @@ function buildMemoryReporter(options) {
|
|
|
685
701
|
return this.getLogMessages().join('\n');
|
|
686
702
|
},
|
|
687
703
|
getLogMessages() {
|
|
688
|
-
return logs.map(_platform_js__WEBPACK_IMPORTED_MODULE_0__.toInspectLogEntry)
|
|
689
|
-
.map(log => log.args.join(' '));
|
|
704
|
+
return logs.map(_platform_js__WEBPACK_IMPORTED_MODULE_0__.toInspectLogEntry).map(log => log.args.join(' '));
|
|
690
705
|
},
|
|
691
706
|
getLogMessagesWithIdAndLevel() {
|
|
692
|
-
return logs
|
|
707
|
+
return logs
|
|
708
|
+
.map(_platform_js__WEBPACK_IMPORTED_MODULE_0__.toInspectLogEntry)
|
|
693
709
|
.map(log => `${log.id} ${(0,_formatter_js__WEBPACK_IMPORTED_MODULE_1__.formatLogLevel)(log.level)} ${log.args.join(' ')}`);
|
|
694
710
|
},
|
|
695
|
-
getLogMessageWithLevel() {
|
|
711
|
+
getLogMessageWithLevel() {
|
|
712
|
+
return toMessageWithLevel(logs);
|
|
713
|
+
},
|
|
696
714
|
/**
|
|
697
715
|
* emit the saved log to console for easy debugging
|
|
698
716
|
*/
|
|
@@ -723,7 +741,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
723
741
|
/* harmony export */ "polyfill": function() { return /* binding */ polyfill; },
|
|
724
742
|
/* harmony export */ "toInspectLogEntry": function() { return /* binding */ toInspectLogEntry; }
|
|
725
743
|
/* harmony export */ });
|
|
726
|
-
/* harmony import */ var type_plus__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! type-plus */ "../../node_modules/.pnpm/type-plus@5.0
|
|
744
|
+
/* harmony import */ var type_plus__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! type-plus */ "../../node_modules/.pnpm/type-plus@6.5.0/node_modules/type-plus/esm/object/record.js");
|
|
727
745
|
|
|
728
746
|
const toInspectLogEntry = (e) => e;
|
|
729
747
|
const polyfill = (0,type_plus__WEBPACK_IMPORTED_MODULE_0__.record)();
|
|
@@ -731,10 +749,10 @@ const polyfill = (0,type_plus__WEBPACK_IMPORTED_MODULE_0__.record)();
|
|
|
731
749
|
|
|
732
750
|
/***/ }),
|
|
733
751
|
|
|
734
|
-
/***/ "./ts/
|
|
735
|
-
|
|
736
|
-
!*** ./ts/
|
|
737
|
-
|
|
752
|
+
/***/ "./ts/standard_log.ctx.ts":
|
|
753
|
+
/*!********************************!*\
|
|
754
|
+
!*** ./ts/standard_log.ctx.ts ***!
|
|
755
|
+
\********************************/
|
|
738
756
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
739
757
|
|
|
740
758
|
"use strict";
|
|
@@ -742,17 +760,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
742
760
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
743
761
|
/* harmony export */ "ctx": function() { return /* binding */ ctx; }
|
|
744
762
|
/* harmony export */ });
|
|
745
|
-
/* harmony import */ var type_plus__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! type-plus */ "../../node_modules/.pnpm/type-plus@5.0
|
|
763
|
+
/* harmony import */ var type_plus__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! type-plus */ "../../node_modules/.pnpm/type-plus@6.5.0/node_modules/type-plus/esm/object/record.js");
|
|
746
764
|
|
|
747
765
|
const ctx = (0,type_plus__WEBPACK_IMPORTED_MODULE_0__.record)();
|
|
748
766
|
|
|
749
767
|
|
|
750
768
|
/***/ }),
|
|
751
769
|
|
|
752
|
-
/***/ "./ts/
|
|
753
|
-
|
|
754
|
-
!*** ./ts/
|
|
755
|
-
|
|
770
|
+
/***/ "./ts/standard_log.ts":
|
|
771
|
+
/*!****************************!*\
|
|
772
|
+
!*** ./ts/standard_log.ts ***!
|
|
773
|
+
\****************************/
|
|
756
774
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
757
775
|
|
|
758
776
|
"use strict";
|
|
@@ -761,18 +779,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
761
779
|
/* harmony export */ "configGlobal": function() { return /* binding */ configGlobal; },
|
|
762
780
|
/* harmony export */ "createStandardLog": function() { return /* binding */ createStandardLog; },
|
|
763
781
|
/* harmony export */ "createStandardLogClosure": function() { return /* binding */ createStandardLogClosure; },
|
|
764
|
-
/* harmony export */ "createStandardLogForTest": function() { return /* binding */ createStandardLogForTest; },
|
|
765
782
|
/* harmony export */ "getLogger": function() { return /* binding */ getLogger; },
|
|
766
783
|
/* harmony export */ "suppressLogs": function() { return /* binding */ suppressLogs; }
|
|
767
784
|
/* harmony export */ });
|
|
768
785
|
/* harmony import */ var type_plus__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! type-plus */ "../../node_modules/.pnpm/unpartial@1.0.4/node_modules/unpartial/esm/index.js");
|
|
769
|
-
/* harmony import */ var type_plus__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! type-plus */ "../../node_modules/.pnpm/type-plus@5.0
|
|
786
|
+
/* harmony import */ var type_plus__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! type-plus */ "../../node_modules/.pnpm/type-plus@6.5.0/node_modules/type-plus/esm/object/record.js");
|
|
787
|
+
/* harmony import */ var _log_levels_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./log_levels.js */ "./ts/log_levels.ts");
|
|
788
|
+
/* harmony import */ var _log_store_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./log_store.js */ "./ts/log_store.ts");
|
|
770
789
|
/* harmony import */ var _logger_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./logger.js */ "./ts/logger.ts");
|
|
771
|
-
/* harmony import */ var
|
|
772
|
-
/* harmony import */ var _logStore_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./logStore.js */ "./ts/logStore.ts");
|
|
773
|
-
/* harmony import */ var _memory_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./memory.js */ "./ts/memory.ts");
|
|
774
|
-
/* harmony import */ var _standardLog_ctx_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./standardLog.ctx.js */ "./ts/standardLog.ctx.ts");
|
|
775
|
-
|
|
790
|
+
/* harmony import */ var _standard_log_ctx_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./standard_log.ctx.js */ "./ts/standard_log.ctx.ts");
|
|
776
791
|
|
|
777
792
|
|
|
778
793
|
|
|
@@ -785,22 +800,27 @@ function createStandardLog(options) {
|
|
|
785
800
|
const log = closure.standardLog.getLogger('standard-log');
|
|
786
801
|
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.`);
|
|
787
802
|
}
|
|
788
|
-
if (!
|
|
789
|
-
|
|
803
|
+
if (!_standard_log_ctx_js__WEBPACK_IMPORTED_MODULE_0__.ctx.gsl)
|
|
804
|
+
_standard_log_ctx_js__WEBPACK_IMPORTED_MODULE_0__.ctx.gsl = closure;
|
|
790
805
|
return closure.standardLog;
|
|
791
806
|
}
|
|
792
807
|
function noop() { }
|
|
793
808
|
function createStandardLogClosure(options) {
|
|
794
809
|
var _a, _b, _c;
|
|
795
810
|
// TODO reporter.id must not be empty
|
|
796
|
-
const store = (0,
|
|
811
|
+
const store = (0,_log_store_js__WEBPACK_IMPORTED_MODULE_1__.createLogStore)((0,type_plus__WEBPACK_IMPORTED_MODULE_2__.required)({ logLevel: _log_levels_js__WEBPACK_IMPORTED_MODULE_3__.logLevels.info }, options));
|
|
797
812
|
const nonConsoleReporters = (_b = (_a = options === null || options === void 0 ? void 0 : options.reporters) === null || _a === void 0 ? void 0 : _a.filter(r => !r.isConsoleReporter).map(r => r.id)) !== null && _b !== void 0 ? _b : [];
|
|
798
|
-
const logMethods =
|
|
799
|
-
|
|
813
|
+
const logMethods = _log_levels_js__WEBPACK_IMPORTED_MODULE_3__.DEFAULT_LOG_METHOD_NAMES.concat(Object.keys((_c = options === null || options === void 0 ? void 0 : options.customLevels) !== null && _c !== void 0 ? _c : {})).concat([
|
|
814
|
+
'on',
|
|
815
|
+
'count',
|
|
816
|
+
'write'
|
|
817
|
+
]);
|
|
800
818
|
return {
|
|
801
819
|
store,
|
|
802
820
|
standardLog: {
|
|
803
|
-
get logLevel() {
|
|
821
|
+
get logLevel() {
|
|
822
|
+
return store.logLevel;
|
|
823
|
+
},
|
|
804
824
|
toLogLevelName(level) {
|
|
805
825
|
return store.logLevelStore.getName(level);
|
|
806
826
|
},
|
|
@@ -810,7 +830,7 @@ function createStandardLogClosure(options) {
|
|
|
810
830
|
getLogger(id, options) {
|
|
811
831
|
if (store.loggers[id])
|
|
812
832
|
return store.loggers[id];
|
|
813
|
-
return store.loggers[id] = (0,_logger_js__WEBPACK_IMPORTED_MODULE_4__.createLogger)(store, id, { ssf: this.getLogger, ...options });
|
|
833
|
+
return (store.loggers[id] = (0,_logger_js__WEBPACK_IMPORTED_MODULE_4__.createLogger)(store, id, { ssf: this.getLogger, ...options }));
|
|
814
834
|
},
|
|
815
835
|
getNonConsoleLogger(id, options) {
|
|
816
836
|
if (store.nonConsoleLoggers[id])
|
|
@@ -818,18 +838,19 @@ function createStandardLogClosure(options) {
|
|
|
818
838
|
if (store.loggers[id]) {
|
|
819
839
|
const log = this.getLogger('standard-log');
|
|
820
840
|
log.warn(`attempt to create a non-console logger with existing id ('${id}'), ignoring`);
|
|
821
|
-
return store.nonConsoleLoggers[id] = createDummyLogger(logMethods);
|
|
841
|
+
return (store.nonConsoleLoggers[id] = createDummyLogger(logMethods));
|
|
822
842
|
}
|
|
823
|
-
return store.nonConsoleLoggers[id] =
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
843
|
+
return (store.nonConsoleLoggers[id] =
|
|
844
|
+
nonConsoleReporters.length === 0
|
|
845
|
+
? createDummyLogger(logMethods)
|
|
846
|
+
: (0,_logger_js__WEBPACK_IMPORTED_MODULE_4__.createLogger)(store, id, {
|
|
847
|
+
ssf: this.getNonConsoleLogger,
|
|
848
|
+
...options,
|
|
849
|
+
writeTo(reporterId) {
|
|
850
|
+
return nonConsoleReporters.indexOf(reporterId) >= 0;
|
|
851
|
+
}
|
|
852
|
+
}));
|
|
853
|
+
}
|
|
833
854
|
}
|
|
834
855
|
};
|
|
835
856
|
}
|
|
@@ -839,45 +860,40 @@ function createDummyLogger(logMethods) {
|
|
|
839
860
|
return p;
|
|
840
861
|
}, (0,type_plus__WEBPACK_IMPORTED_MODULE_5__.record)());
|
|
841
862
|
}
|
|
842
|
-
function createStandardLogForTest(logLevel = _logLevels_js__WEBPACK_IMPORTED_MODULE_3__.logLevels.debug) {
|
|
843
|
-
const reporter = (0,_memory_js__WEBPACK_IMPORTED_MODULE_6__.createMemoryLogReporter)();
|
|
844
|
-
const closure = createStandardLogClosure({ reporters: [reporter], logLevel });
|
|
845
|
-
return { ...closure.standardLog, reporter };
|
|
846
|
-
}
|
|
847
863
|
function suppressLogs(block, ...logs) {
|
|
848
864
|
const origLevels = logs.map(l => l.level);
|
|
849
|
-
logs.forEach(l => l.level =
|
|
865
|
+
logs.forEach(l => (l.level = _log_levels_js__WEBPACK_IMPORTED_MODULE_3__.logLevels.none));
|
|
850
866
|
const result = block();
|
|
851
|
-
logs.forEach((l, i) => l.level = origLevels[i]);
|
|
867
|
+
logs.forEach((l, i) => (l.level = origLevels[i]));
|
|
852
868
|
return result;
|
|
853
869
|
}
|
|
854
870
|
function getLogger(id, options) {
|
|
855
871
|
return getGlobalSL().getLogger(id, options);
|
|
856
872
|
}
|
|
857
873
|
function getGlobalSL() {
|
|
858
|
-
if (!
|
|
859
|
-
|
|
860
|
-
return
|
|
874
|
+
if (!_standard_log_ctx_js__WEBPACK_IMPORTED_MODULE_0__.ctx.gsl)
|
|
875
|
+
_standard_log_ctx_js__WEBPACK_IMPORTED_MODULE_0__.ctx.gsl = createStandardLogClosure();
|
|
876
|
+
return _standard_log_ctx_js__WEBPACK_IMPORTED_MODULE_0__.ctx.gsl.standardLog;
|
|
861
877
|
}
|
|
862
878
|
function configGlobal(options) {
|
|
863
|
-
if (
|
|
864
|
-
const log =
|
|
879
|
+
if (_standard_log_ctx_js__WEBPACK_IMPORTED_MODULE_0__.ctx.configured) {
|
|
880
|
+
const log = _standard_log_ctx_js__WEBPACK_IMPORTED_MODULE_0__.ctx.gsl.standardLog.getLogger('standard-log');
|
|
865
881
|
log.warn('configGlobal() is being called more than once. Please make sure this is expected. Application should use `createStandardLog()` most of the time.');
|
|
866
882
|
}
|
|
867
|
-
if (
|
|
883
|
+
if (_standard_log_ctx_js__WEBPACK_IMPORTED_MODULE_0__.ctx.gsl) {
|
|
868
884
|
if (options.logLevel) {
|
|
869
|
-
|
|
885
|
+
_standard_log_ctx_js__WEBPACK_IMPORTED_MODULE_0__.ctx.gsl.store.logLevel = options.logLevel;
|
|
870
886
|
}
|
|
871
887
|
if (options.reporters) {
|
|
872
|
-
const reporters =
|
|
888
|
+
const reporters = _standard_log_ctx_js__WEBPACK_IMPORTED_MODULE_0__.ctx.gsl.store.reporters;
|
|
873
889
|
reporters.length = 0;
|
|
874
890
|
reporters.push(...options.reporters);
|
|
875
891
|
}
|
|
876
892
|
}
|
|
877
893
|
else {
|
|
878
|
-
|
|
894
|
+
_standard_log_ctx_js__WEBPACK_IMPORTED_MODULE_0__.ctx.gsl = createStandardLogClosure(options);
|
|
879
895
|
}
|
|
880
|
-
|
|
896
|
+
_standard_log_ctx_js__WEBPACK_IMPORTED_MODULE_0__.ctx.configured = true;
|
|
881
897
|
}
|
|
882
898
|
|
|
883
899
|
|
|
@@ -942,9 +958,9 @@ exports.upperCase = upperCase;
|
|
|
942
958
|
|
|
943
959
|
/***/ }),
|
|
944
960
|
|
|
945
|
-
/***/ "../../node_modules/.pnpm/iso-error@
|
|
961
|
+
/***/ "../../node_modules/.pnpm/iso-error@6.0.1/node_modules/iso-error/esm/index.js":
|
|
946
962
|
/*!************************************************************************************!*\
|
|
947
|
-
!*** ../../node_modules/.pnpm/iso-error@
|
|
963
|
+
!*** ../../node_modules/.pnpm/iso-error@6.0.1/node_modules/iso-error/esm/index.js ***!
|
|
948
964
|
\************************************************************************************/
|
|
949
965
|
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
950
966
|
|
|
@@ -956,13 +972,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
956
972
|
/* harmony export */ "SerializableConverter": function() { return /* binding */ SerializableConverter; },
|
|
957
973
|
/* harmony export */ "isAggregateError": function() { return /* binding */ isAggregateError; }
|
|
958
974
|
/* harmony export */ });
|
|
959
|
-
/* eslint-disable @typescript-eslint/unbound-method */
|
|
960
975
|
var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
961
976
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
962
977
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
963
978
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
964
979
|
};
|
|
965
|
-
var
|
|
980
|
+
var _a, _IsoError_hasCause, _IsoError_toIsoError;
|
|
966
981
|
//#region captureStackTrace polyfill
|
|
967
982
|
// istanbul ignore next
|
|
968
983
|
if (!Error.captureStackTrace) {
|
|
@@ -975,7 +990,9 @@ if (!Error.captureStackTrace) {
|
|
|
975
990
|
defineStack(this, container.stack);
|
|
976
991
|
return container.stack;
|
|
977
992
|
},
|
|
978
|
-
set: function (stack) {
|
|
993
|
+
set: function (stack) {
|
|
994
|
+
defineStack(error, stack);
|
|
995
|
+
}
|
|
979
996
|
});
|
|
980
997
|
};
|
|
981
998
|
}
|
|
@@ -984,76 +1001,96 @@ function defineStack(target, value) {
|
|
|
984
1001
|
Object.defineProperty(target, 'stack', {
|
|
985
1002
|
configurable: true,
|
|
986
1003
|
value,
|
|
987
|
-
writable: true
|
|
1004
|
+
writable: true
|
|
988
1005
|
});
|
|
989
1006
|
}
|
|
990
1007
|
class SerializableConverter {
|
|
991
1008
|
constructor() {
|
|
992
|
-
|
|
993
|
-
|
|
1009
|
+
Object.defineProperty(this, "plugins", {
|
|
1010
|
+
enumerable: true,
|
|
1011
|
+
configurable: true,
|
|
1012
|
+
writable: true,
|
|
1013
|
+
value: []
|
|
1014
|
+
});
|
|
994
1015
|
}
|
|
995
1016
|
addPlugin(plugin) {
|
|
996
|
-
|
|
1017
|
+
this.plugins.unshift(plugin);
|
|
997
1018
|
}
|
|
998
1019
|
/**
|
|
999
1020
|
* Deserialize an `Error` from `Serializable`
|
|
1000
1021
|
*/
|
|
1001
1022
|
fromSerializable(json, options) {
|
|
1002
|
-
const err =
|
|
1023
|
+
const err = this.deserializeError(json);
|
|
1003
1024
|
Error.captureStackTrace(err, options?.ssf);
|
|
1004
1025
|
return err;
|
|
1005
1026
|
}
|
|
1027
|
+
fromSerializableImpl(json) {
|
|
1028
|
+
if (json.name === 'AggregateError') {
|
|
1029
|
+
const { message, errors, ...rest } = json;
|
|
1030
|
+
// @ts-ignore
|
|
1031
|
+
// istanbul ignore next
|
|
1032
|
+
if (global.AggregateError) {
|
|
1033
|
+
return Object.assign(new AggregateError(errors, message), rest);
|
|
1034
|
+
}
|
|
1035
|
+
else {
|
|
1036
|
+
return Object.assign(new Error(message), {
|
|
1037
|
+
...rest,
|
|
1038
|
+
errors
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
const { message, cause, ...rest } = json;
|
|
1043
|
+
const causeError = cause ? this.deserializeError(cause) : undefined;
|
|
1044
|
+
if (json.name === 'Error') {
|
|
1045
|
+
return Object.assign(new Error(message), causeError ? { ...rest, cause: causeError } : rest);
|
|
1046
|
+
}
|
|
1047
|
+
// @ts-ignore
|
|
1048
|
+
return Object.assign(new IsoError(message, causeError ? { cause: causeError } : undefined), rest);
|
|
1049
|
+
}
|
|
1050
|
+
deserializeError(json) {
|
|
1051
|
+
let err = undefined;
|
|
1052
|
+
for (const { fromSerializable } of this.plugins) {
|
|
1053
|
+
err = fromSerializable(json);
|
|
1054
|
+
if (err)
|
|
1055
|
+
break;
|
|
1056
|
+
}
|
|
1057
|
+
return err || this.fromSerializableImpl(json);
|
|
1058
|
+
}
|
|
1006
1059
|
/**
|
|
1007
1060
|
* Serialize `Error` to `Serializable`
|
|
1008
1061
|
*/
|
|
1009
1062
|
toSerializable(err) {
|
|
1010
|
-
return
|
|
1063
|
+
return (this.plugins.reduce((p, s) => p || s.toSerializable(err), undefined) || this.toSerializableImpl(err));
|
|
1011
1064
|
}
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1065
|
+
toSerializableImpl(err) {
|
|
1066
|
+
if (isAggregateError(err)) {
|
|
1067
|
+
return {
|
|
1068
|
+
...err,
|
|
1069
|
+
name: err.constructor.name,
|
|
1070
|
+
message: err.message,
|
|
1071
|
+
errors: err.errors.map(this.toSerializableImpl)
|
|
1072
|
+
};
|
|
1020
1073
|
}
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1074
|
+
if (err instanceof Error) {
|
|
1075
|
+
const { message, cause } = err;
|
|
1076
|
+
return cause
|
|
1077
|
+
? { ...err, name: err.constructor.name, message, cause: this.toSerializableImpl(cause) }
|
|
1078
|
+
: { ...err, name: err.constructor.name, message };
|
|
1026
1079
|
}
|
|
1080
|
+
return err;
|
|
1027
1081
|
}
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
break;
|
|
1041
|
-
}
|
|
1042
|
-
return err || __classPrivateFieldGet(this, _SerializableConverter_instances, "m", _SerializableConverter_fromSerializable).call(this, json);
|
|
1043
|
-
}, _SerializableConverter_toSerializable = function _SerializableConverter_toSerializable(err) {
|
|
1044
|
-
if (isAggregateError(err)) {
|
|
1045
|
-
return {
|
|
1046
|
-
...err, name: err.constructor.name, message: err.message,
|
|
1047
|
-
errors: err.errors.map(__classPrivateFieldGet(this, _SerializableConverter_instances, "m", _SerializableConverter_toSerializable))
|
|
1048
|
-
};
|
|
1049
|
-
}
|
|
1050
|
-
if (err instanceof Error) {
|
|
1051
|
-
const { message, cause } = err;
|
|
1052
|
-
return cause
|
|
1053
|
-
? { ...err, name: err.constructor.name, message, cause: __classPrivateFieldGet(this, _SerializableConverter_instances, "m", _SerializableConverter_toSerializable).call(this, cause) }
|
|
1054
|
-
: { ...err, name: err.constructor.name, message };
|
|
1055
|
-
}
|
|
1056
|
-
return err;
|
|
1082
|
+
}
|
|
1083
|
+
const getCircularReplacer = () => {
|
|
1084
|
+
const seen = new WeakSet();
|
|
1085
|
+
return (_, value) => {
|
|
1086
|
+
if (typeof value === 'object' && value !== null) {
|
|
1087
|
+
if (seen.has(value)) {
|
|
1088
|
+
return;
|
|
1089
|
+
}
|
|
1090
|
+
seen.add(value);
|
|
1091
|
+
}
|
|
1092
|
+
return value;
|
|
1093
|
+
};
|
|
1057
1094
|
};
|
|
1058
1095
|
/**
|
|
1059
1096
|
* Isomorphic Error that works across physical boundary.
|
|
@@ -1072,7 +1109,7 @@ class IsoError extends Error {
|
|
|
1072
1109
|
return this.serialize(err);
|
|
1073
1110
|
}
|
|
1074
1111
|
static serialize(err) {
|
|
1075
|
-
return JSON.stringify(this.toSerializable(err));
|
|
1112
|
+
return JSON.stringify(this.toSerializable(err), getCircularReplacer());
|
|
1076
1113
|
}
|
|
1077
1114
|
static toSerializable(err) {
|
|
1078
1115
|
return this.converter.toSerializable(err);
|
|
@@ -1108,11 +1145,15 @@ class IsoError extends Error {
|
|
|
1108
1145
|
messages.push(`${err.name}: ${err.message}`);
|
|
1109
1146
|
}
|
|
1110
1147
|
if (isAggregateError(err)) {
|
|
1111
|
-
err.errors.forEach(e => messages.push(...this.trace(e)
|
|
1148
|
+
err.errors.forEach(e => messages.push(...this.trace(e)
|
|
1149
|
+
.split('\n')
|
|
1150
|
+
.map(s => ' ' + s)));
|
|
1112
1151
|
}
|
|
1113
1152
|
if (err instanceof Error) {
|
|
1114
1153
|
if (__classPrivateFieldGet(this, _a, "m", _IsoError_hasCause).call(this, err))
|
|
1115
|
-
messages.push(...this.trace(err.cause)
|
|
1154
|
+
messages.push(...this.trace(err.cause)
|
|
1155
|
+
.split('\n')
|
|
1156
|
+
.map(s => ' ' + s));
|
|
1116
1157
|
}
|
|
1117
1158
|
else {
|
|
1118
1159
|
messages.push(typeof err === 'string' ? err : JSON.stringify(err));
|
|
@@ -1156,18 +1197,20 @@ class IsoError extends Error {
|
|
|
1156
1197
|
if (options?.ssf)
|
|
1157
1198
|
Error.captureStackTrace(this, options.ssf);
|
|
1158
1199
|
}
|
|
1159
|
-
toString() {
|
|
1160
|
-
|
|
1200
|
+
toString() {
|
|
1201
|
+
return IsoError.serialize(this);
|
|
1202
|
+
}
|
|
1203
|
+
trace() {
|
|
1204
|
+
return IsoError.trace(this);
|
|
1205
|
+
}
|
|
1161
1206
|
}
|
|
1162
1207
|
_a = IsoError, _IsoError_hasCause = function _IsoError_hasCause(x) {
|
|
1163
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
1164
1208
|
return !!x.cause;
|
|
1165
1209
|
}, _IsoError_toIsoError = function _IsoError_toIsoError(err) {
|
|
1166
|
-
if (err instanceof IsoError)
|
|
1167
|
-
return err;
|
|
1168
1210
|
// When the error is an internal error from deserialization,
|
|
1169
|
-
// the err.constructor.name is object
|
|
1170
|
-
|
|
1211
|
+
// the err.constructor.name is object.
|
|
1212
|
+
// I have to to Object.assign to keep the err instance and its stack trace.
|
|
1213
|
+
return Object.assign(err, { name: err.name ?? err.constructor.name });
|
|
1171
1214
|
};
|
|
1172
1215
|
Object.defineProperty(IsoError, "converter", {
|
|
1173
1216
|
enumerable: true,
|
|
@@ -1175,6 +1218,7 @@ Object.defineProperty(IsoError, "converter", {
|
|
|
1175
1218
|
writable: true,
|
|
1176
1219
|
value: new SerializableConverter()
|
|
1177
1220
|
});
|
|
1221
|
+
|
|
1178
1222
|
/**
|
|
1179
1223
|
* An IsoError with a module property.
|
|
1180
1224
|
*/
|
|
@@ -1199,9 +1243,9 @@ function isAggregateError(error) {
|
|
|
1199
1243
|
|
|
1200
1244
|
/***/ }),
|
|
1201
1245
|
|
|
1202
|
-
/***/ "../../node_modules/.pnpm/type-plus@5.0
|
|
1246
|
+
/***/ "../../node_modules/.pnpm/type-plus@6.5.0/node_modules/type-plus/esm/object/mapKey.js":
|
|
1203
1247
|
/*!********************************************************************************************!*\
|
|
1204
|
-
!*** ../../node_modules/.pnpm/type-plus@5.0
|
|
1248
|
+
!*** ../../node_modules/.pnpm/type-plus@6.5.0/node_modules/type-plus/esm/object/mapKey.js ***!
|
|
1205
1249
|
\********************************************************************************************/
|
|
1206
1250
|
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1207
1251
|
|
|
@@ -1211,15 +1255,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1211
1255
|
/* harmony export */ "mapKey": function() { return /* binding */ mapKey; }
|
|
1212
1256
|
/* harmony export */ });
|
|
1213
1257
|
function mapKey(subject, predicate, thisArg) {
|
|
1214
|
-
return Object.keys(subject).map(
|
|
1258
|
+
return Object.keys(subject).map(function (k, i, a) {
|
|
1259
|
+
return predicate.apply(this, [k, i, a, subject]);
|
|
1260
|
+
}, thisArg);
|
|
1215
1261
|
}
|
|
1216
1262
|
//# sourceMappingURL=mapKey.js.map
|
|
1217
1263
|
|
|
1218
1264
|
/***/ }),
|
|
1219
1265
|
|
|
1220
|
-
/***/ "../../node_modules/.pnpm/type-plus@5.0
|
|
1266
|
+
/***/ "../../node_modules/.pnpm/type-plus@6.5.0/node_modules/type-plus/esm/object/record.js":
|
|
1221
1267
|
/*!********************************************************************************************!*\
|
|
1222
|
-
!*** ../../node_modules/.pnpm/type-plus@5.0
|
|
1268
|
+
!*** ../../node_modules/.pnpm/type-plus@6.5.0/node_modules/type-plus/esm/object/record.js ***!
|
|
1223
1269
|
\********************************************************************************************/
|
|
1224
1270
|
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1225
1271
|
|
|
@@ -1236,9 +1282,9 @@ function record(value) {
|
|
|
1236
1282
|
|
|
1237
1283
|
/***/ }),
|
|
1238
1284
|
|
|
1239
|
-
/***/ "../../node_modules/.pnpm/type-plus@5.0
|
|
1285
|
+
/***/ "../../node_modules/.pnpm/type-plus@6.5.0/node_modules/type-plus/esm/object/reduceKey.js":
|
|
1240
1286
|
/*!***********************************************************************************************!*\
|
|
1241
|
-
!*** ../../node_modules/.pnpm/type-plus@5.0
|
|
1287
|
+
!*** ../../node_modules/.pnpm/type-plus@6.5.0/node_modules/type-plus/esm/object/reduceKey.js ***!
|
|
1242
1288
|
\***********************************************************************************************/
|
|
1243
1289
|
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1244
1290
|
|
|
@@ -1249,7 +1295,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1249
1295
|
/* harmony export */ "reduceKey": function() { return /* binding */ reduceKey; }
|
|
1250
1296
|
/* harmony export */ });
|
|
1251
1297
|
function reduceByKey(subject, callbackfn, initialValue) {
|
|
1252
|
-
return Object.keys(subject).reduce(callbackfn, initialValue);
|
|
1298
|
+
return Object.keys(subject).reduce((p, k, i, a) => callbackfn(p, k, i, a, subject), initialValue);
|
|
1253
1299
|
}
|
|
1254
1300
|
/**
|
|
1255
1301
|
* @deprecated renamed to reduceByKey
|
|
@@ -1413,33 +1459,32 @@ var __webpack_exports__ = {};
|
|
|
1413
1459
|
\*********************/
|
|
1414
1460
|
__webpack_require__.r(__webpack_exports__);
|
|
1415
1461
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1416
|
-
/* harmony export */ "DEFAULT_LOG_METHOD_NAMES": function() { return /* reexport safe */
|
|
1462
|
+
/* harmony export */ "DEFAULT_LOG_METHOD_NAMES": function() { return /* reexport safe */ _log_levels_js__WEBPACK_IMPORTED_MODULE_3__.DEFAULT_LOG_METHOD_NAMES; },
|
|
1417
1463
|
/* harmony export */ "InvalidId": function() { return /* reexport safe */ _errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidId; },
|
|
1418
1464
|
/* harmony export */ "StandardLogError": function() { return /* reexport safe */ _errors_js__WEBPACK_IMPORTED_MODULE_1__.StandardLogError; },
|
|
1419
|
-
/* harmony export */ "configGlobal": function() { return /* reexport safe */
|
|
1465
|
+
/* harmony export */ "configGlobal": function() { return /* reexport safe */ _standard_log_js__WEBPACK_IMPORTED_MODULE_5__.configGlobal; },
|
|
1420
1466
|
/* harmony export */ "consoleFormatter": function() { return /* reexport safe */ _formatter_js__WEBPACK_IMPORTED_MODULE_2__.consoleFormatter; },
|
|
1421
1467
|
/* harmony export */ "createConsoleLogReporter": function() { return /* reexport safe */ _console_js__WEBPACK_IMPORTED_MODULE_0__.createConsoleLogReporter; },
|
|
1422
1468
|
/* harmony export */ "createMemoryLogReporter": function() { return /* reexport safe */ _memory_js__WEBPACK_IMPORTED_MODULE_4__.createMemoryLogReporter; },
|
|
1423
1469
|
/* harmony export */ "createMemoryWithConsoleLogReporter": function() { return /* reexport safe */ _memory_js__WEBPACK_IMPORTED_MODULE_4__.createMemoryWithConsoleLogReporter; },
|
|
1424
|
-
/* harmony export */ "createStandardLog": function() { return /* reexport safe */
|
|
1425
|
-
/* harmony export */ "createStandardLogForTest": function() { return /* reexport safe */ _standardLog_js__WEBPACK_IMPORTED_MODULE_5__.createStandardLogForTest; },
|
|
1470
|
+
/* harmony export */ "createStandardLog": function() { return /* reexport safe */ _standard_log_js__WEBPACK_IMPORTED_MODULE_5__.createStandardLog; },
|
|
1426
1471
|
/* harmony export */ "createTimestampFormatter": function() { return /* reexport safe */ _formatter_js__WEBPACK_IMPORTED_MODULE_2__.createTimestampFormatter; },
|
|
1427
1472
|
/* harmony export */ "formatLogLevel": function() { return /* reexport safe */ _formatter_js__WEBPACK_IMPORTED_MODULE_2__.formatLogLevel; },
|
|
1428
|
-
/* harmony export */ "getLogger": function() { return /* reexport safe */
|
|
1429
|
-
/* harmony export */ "logLevels": function() { return /* reexport safe */
|
|
1473
|
+
/* harmony export */ "getLogger": function() { return /* reexport safe */ _standard_log_js__WEBPACK_IMPORTED_MODULE_5__.getLogger; },
|
|
1474
|
+
/* harmony export */ "logLevels": function() { return /* reexport safe */ _log_levels_js__WEBPACK_IMPORTED_MODULE_3__.logLevels; },
|
|
1430
1475
|
/* harmony export */ "plainLogFormatter": function() { return /* reexport safe */ _formatter_js__WEBPACK_IMPORTED_MODULE_2__.plainLogFormatter; },
|
|
1431
|
-
/* harmony export */ "suppressLogs": function() { return /* reexport safe */
|
|
1476
|
+
/* harmony export */ "suppressLogs": function() { return /* reexport safe */ _standard_log_js__WEBPACK_IMPORTED_MODULE_5__.suppressLogs; },
|
|
1432
1477
|
/* harmony export */ "toConsoleMethod": function() { return /* reexport safe */ _console_js__WEBPACK_IMPORTED_MODULE_0__.toConsoleMethod; },
|
|
1433
|
-
/* harmony export */ "toLogLevel": function() { return /* reexport safe */
|
|
1434
|
-
/* harmony export */ "toLogLevelName": function() { return /* reexport safe */
|
|
1478
|
+
/* harmony export */ "toLogLevel": function() { return /* reexport safe */ _log_levels_js__WEBPACK_IMPORTED_MODULE_3__.toLogLevel; },
|
|
1479
|
+
/* harmony export */ "toLogLevelName": function() { return /* reexport safe */ _log_levels_js__WEBPACK_IMPORTED_MODULE_3__.toLogLevelName; },
|
|
1435
1480
|
/* harmony export */ "toMessageWithLevel": function() { return /* reexport safe */ _memory_js__WEBPACK_IMPORTED_MODULE_4__.toMessageWithLevel; }
|
|
1436
1481
|
/* harmony export */ });
|
|
1437
1482
|
/* harmony import */ var _console_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./console.js */ "./ts/console.ts");
|
|
1438
1483
|
/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./errors.js */ "./ts/errors.ts");
|
|
1439
1484
|
/* harmony import */ var _formatter_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./formatter.js */ "./ts/formatter.ts");
|
|
1440
|
-
/* harmony import */ var
|
|
1485
|
+
/* harmony import */ var _log_levels_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./log_levels.js */ "./ts/log_levels.ts");
|
|
1441
1486
|
/* harmony import */ var _memory_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./memory.js */ "./ts/memory.ts");
|
|
1442
|
-
/* harmony import */ var
|
|
1487
|
+
/* harmony import */ var _standard_log_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./standard_log.js */ "./ts/standard_log.ts");
|
|
1443
1488
|
|
|
1444
1489
|
|
|
1445
1490
|
|