standard-log 8.0.0 → 8.0.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.
- package/cjs/config.js +1 -1
- package/cjs/config.js.map +1 -1
- package/cjs/config.spec.js +6 -0
- package/cjs/config.spec.js.map +1 -1
- package/cjs/console/createConsoleLogReporter.d.ts.map +1 -1
- package/cjs/console/createConsoleLogReporter.js +2 -2
- package/cjs/console/createConsoleLogReporter.js.map +1 -1
- package/cjs/console/createConsoleLogReporter.spec.js +13 -0
- package/cjs/console/createConsoleLogReporter.spec.js.map +1 -1
- package/cjs/errors.d.ts +3 -3
- package/cjs/errors.d.ts.map +1 -1
- package/cjs/errors.js +6 -6
- package/cjs/errors.js.map +1 -1
- package/cjs/getLogModeFromEnvironment.js +1 -1
- package/cjs/getLogModeFromEnvironment.js.map +1 -1
- package/cjs/getLogModeFromEnvironment.spec.js +6 -0
- package/cjs/getLogModeFromEnvironment.spec.js.map +1 -1
- package/cjs/getLogger.js +1 -1
- package/cjs/getLogger.js.map +1 -1
- package/cjs/getLogger.spec.js +4 -0
- package/cjs/getLogger.spec.js.map +1 -1
- package/cjs/logReporter.js +2 -2
- package/cjs/logReporter.js.map +1 -1
- package/cjs/logReporter.spec.js +12 -0
- package/cjs/logReporter.spec.js.map +1 -1
- package/cjs/memory/MemoryLogReporter.d.ts.map +1 -1
- package/cjs/memory/MemoryLogReporter.js +2 -2
- package/cjs/memory/MemoryLogReporter.js.map +1 -1
- package/cjs/memory/MemoryLogReporter.spec.js +13 -0
- package/cjs/memory/MemoryLogReporter.spec.js.map +1 -1
- package/cjs/testUtil.d.ts +1 -0
- package/cjs/testUtil.d.ts.map +1 -1
- package/cjs/testUtil.js +7 -1
- package/cjs/testUtil.js.map +1 -1
- package/cjs/utils.d.ts +2 -1
- package/cjs/utils.d.ts.map +1 -1
- package/cjs/utils.js +3 -2
- package/cjs/utils.js.map +1 -1
- package/dist/standard-log.es5.js +17 -16
- 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 +17 -16
- 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/config.js +1 -1
- package/esm/config.js.map +1 -1
- package/esm/config.spec.js +6 -0
- package/esm/config.spec.js.map +1 -1
- package/esm/console/createConsoleLogReporter.d.ts.map +1 -1
- package/esm/console/createConsoleLogReporter.js +2 -2
- package/esm/console/createConsoleLogReporter.js.map +1 -1
- package/esm/console/createConsoleLogReporter.spec.js +13 -0
- package/esm/console/createConsoleLogReporter.spec.js.map +1 -1
- package/esm/errors.d.ts +3 -3
- package/esm/errors.d.ts.map +1 -1
- package/esm/errors.js +6 -6
- package/esm/errors.js.map +1 -1
- package/esm/getLogModeFromEnvironment.js +1 -1
- package/esm/getLogModeFromEnvironment.js.map +1 -1
- package/esm/getLogModeFromEnvironment.spec.js +6 -0
- package/esm/getLogModeFromEnvironment.spec.js.map +1 -1
- package/esm/getLogger.js +1 -1
- package/esm/getLogger.js.map +1 -1
- package/esm/getLogger.spec.js +5 -1
- package/esm/getLogger.spec.js.map +1 -1
- package/esm/logReporter.js +2 -2
- package/esm/logReporter.js.map +1 -1
- package/esm/logReporter.spec.js +12 -0
- package/esm/logReporter.spec.js.map +1 -1
- package/esm/memory/MemoryLogReporter.d.ts.map +1 -1
- package/esm/memory/MemoryLogReporter.js +2 -2
- package/esm/memory/MemoryLogReporter.js.map +1 -1
- package/esm/memory/MemoryLogReporter.spec.js +13 -0
- package/esm/memory/MemoryLogReporter.spec.js.map +1 -1
- package/esm/testUtil.d.ts +1 -0
- package/esm/testUtil.d.ts.map +1 -1
- package/esm/testUtil.js +4 -0
- package/esm/testUtil.js.map +1 -1
- package/esm/utils.d.ts +2 -1
- package/esm/utils.d.ts.map +1 -1
- package/esm/utils.js +3 -2
- package/esm/utils.js.map +1 -1
- package/package.json +3 -2
- package/ts/config.ts +1 -1
- package/ts/console/createConsoleLogReporter.ts +8 -2
- package/ts/errors.ts +6 -6
- package/ts/getLogModeFromEnvironment.ts +1 -1
- package/ts/getLogger.ts +1 -1
- package/ts/logReporter.ts +2 -2
- package/ts/memory/MemoryLogReporter.ts +8 -2
- package/ts/utils.ts +4 -2
- package/ts/testUtil.ts +0 -19
package/dist/standard-log.es5.js
CHANGED
|
@@ -263,7 +263,7 @@ exports.config = function config(options) {
|
|
|
263
263
|
if (options === void 0) { options = {}; }
|
|
264
264
|
if (store_js_1.store.value.configured) {
|
|
265
265
|
if (store_js_1.store.value.mode === 'production') {
|
|
266
|
-
throw new errors_js_1.ProhibitedDuringProduction('config');
|
|
266
|
+
throw new errors_js_1.ProhibitedDuringProduction('config', { ssf: config });
|
|
267
267
|
}
|
|
268
268
|
if (store_js_1.store.value.mode === 'test' && options.mode !== 'test') {
|
|
269
269
|
var log = (0, getLogger_js_1.getLogger)('standard-log');
|
|
@@ -355,14 +355,14 @@ function createConsoleLogReporter(options) {
|
|
|
355
355
|
return formatter;
|
|
356
356
|
},
|
|
357
357
|
set formatter(value) {
|
|
358
|
-
(0, utils_js_1.assertLogModeIsNotProduction)('set Reporter.formatter');
|
|
358
|
+
(0, utils_js_1.assertLogModeIsNotProduction)('set Reporter.formatter', Object.getOwnPropertyDescriptor(this, 'formatter').set);
|
|
359
359
|
formatter = value;
|
|
360
360
|
},
|
|
361
361
|
get filter() {
|
|
362
362
|
return filter;
|
|
363
363
|
},
|
|
364
364
|
set filter(value) {
|
|
365
|
-
(0, utils_js_1.assertLogModeIsNotProduction)('set Reporter.filter');
|
|
365
|
+
(0, utils_js_1.assertLogModeIsNotProduction)('set Reporter.filter', Object.getOwnPropertyDescriptor(this, 'filter').set);
|
|
366
366
|
filter = value;
|
|
367
367
|
},
|
|
368
368
|
console: polyfilledConsole_js_1.polyfilledConsole,
|
|
@@ -644,8 +644,8 @@ var StandardLogError = /** @class */ (function (_super) {
|
|
|
644
644
|
exports.StandardLogError = StandardLogError;
|
|
645
645
|
var InvalidId = /** @class */ (function (_super) {
|
|
646
646
|
__extends(InvalidId, _super);
|
|
647
|
-
function InvalidId(id) {
|
|
648
|
-
var _this = _super.call(this, "logger id only supports alphanumeric, unicode characters, and [:_-.]. Received ".concat(id)) || this;
|
|
647
|
+
function InvalidId(id, options) {
|
|
648
|
+
var _this = _super.call(this, "logger id only supports alphanumeric, unicode characters, and [:_-.]. Received ".concat(id), options) || this;
|
|
649
649
|
Object.defineProperty(_this, "id", {
|
|
650
650
|
enumerable: true,
|
|
651
651
|
configurable: true,
|
|
@@ -659,8 +659,8 @@ var InvalidId = /** @class */ (function (_super) {
|
|
|
659
659
|
exports.InvalidId = InvalidId;
|
|
660
660
|
var ProhibitedDuringProduction = /** @class */ (function (_super) {
|
|
661
661
|
__extends(ProhibitedDuringProduction, _super);
|
|
662
|
-
function ProhibitedDuringProduction(action) {
|
|
663
|
-
var _this = _super.call(this, "Cannot perform ".concat(action, " during production")) || this;
|
|
662
|
+
function ProhibitedDuringProduction(action, options) {
|
|
663
|
+
var _this = _super.call(this, "Cannot perform ".concat(action, " during production"), options) || this;
|
|
664
664
|
Object.defineProperty(_this, "action", {
|
|
665
665
|
enumerable: true,
|
|
666
666
|
configurable: true,
|
|
@@ -674,8 +674,8 @@ var ProhibitedDuringProduction = /** @class */ (function (_super) {
|
|
|
674
674
|
exports.ProhibitedDuringProduction = ProhibitedDuringProduction;
|
|
675
675
|
var InvalidEnvVar = /** @class */ (function (_super) {
|
|
676
676
|
__extends(InvalidEnvVar, _super);
|
|
677
|
-
function InvalidEnvVar(name, value, possibleValues) {
|
|
678
|
-
var _this = _super.call(this, "".concat(name, " contains invalid value '").concat(value, "'").concat(" valid values: [".concat(possibleValues.join(), "]"))) || this;
|
|
677
|
+
function InvalidEnvVar(name, value, possibleValues, options) {
|
|
678
|
+
var _this = _super.call(this, "".concat(name, " contains invalid value '").concat(value, "'").concat(" valid values: [".concat(possibleValues.join(), "]")), options) || this;
|
|
679
679
|
Object.defineProperty(_this, "name", {
|
|
680
680
|
enumerable: true,
|
|
681
681
|
configurable: true,
|
|
@@ -898,7 +898,7 @@ function getLogger(id, options) {
|
|
|
898
898
|
exports.getLogger = getLogger;
|
|
899
899
|
function validateId(id) {
|
|
900
900
|
if (/[`~!#$%^&*()=+[\]{},|<>?]/.test(id))
|
|
901
|
-
throw new errors_js_1.InvalidId(id);
|
|
901
|
+
throw new errors_js_1.InvalidId(id, { ssf: getLogger });
|
|
902
902
|
}
|
|
903
903
|
function createLoggerClosure(id, _a) {
|
|
904
904
|
var _b = _a === void 0 ? {} : _a, level = _b.level, _c = _b.writeTo, writeTo = _c === void 0 ? function () { return true; } : _c;
|
|
@@ -1212,7 +1212,7 @@ var logReporterInternal_js_1 = __webpack_require__(/*! ./logReporterInternal.js
|
|
|
1212
1212
|
var store_js_1 = __webpack_require__(/*! ./store.js */ "./ts/store.ts");
|
|
1213
1213
|
var utils_js_1 = __webpack_require__(/*! ./utils.js */ "./ts/utils.ts");
|
|
1214
1214
|
function addLogReporter(reporter) {
|
|
1215
|
-
(0, utils_js_1.assertLogModeIsNotProduction)('addLogReporter');
|
|
1215
|
+
(0, utils_js_1.assertLogModeIsNotProduction)('addLogReporter', addLogReporter);
|
|
1216
1216
|
(0, logReporterInternal_js_1.addLogReporterInternal)(reporter);
|
|
1217
1217
|
}
|
|
1218
1218
|
exports.addLogReporter = addLogReporter;
|
|
@@ -1229,7 +1229,7 @@ function getConsoleReporter() {
|
|
|
1229
1229
|
}
|
|
1230
1230
|
exports.getConsoleReporter = getConsoleReporter;
|
|
1231
1231
|
function clearLogReporters() {
|
|
1232
|
-
(0, utils_js_1.assertLogModeIsNotProduction)('clearLogReporters');
|
|
1232
|
+
(0, utils_js_1.assertLogModeIsNotProduction)('clearLogReporters', clearLogReporters);
|
|
1233
1233
|
store_js_1.store.value.reporters.splice(0, store_js_1.store.value.reporters.length);
|
|
1234
1234
|
}
|
|
1235
1235
|
exports.clearLogReporters = clearLogReporters;
|
|
@@ -1311,14 +1311,14 @@ function createMemoryLogReporter(options) {
|
|
|
1311
1311
|
return formatter;
|
|
1312
1312
|
},
|
|
1313
1313
|
set formatter(value) {
|
|
1314
|
-
(0, utils_js_1.assertLogModeIsNotProduction)('set Reporter.formatter');
|
|
1314
|
+
(0, utils_js_1.assertLogModeIsNotProduction)('set Reporter.formatter', Object.getOwnPropertyDescriptor(this, 'formatter').set);
|
|
1315
1315
|
formatter = value;
|
|
1316
1316
|
},
|
|
1317
1317
|
get filter() {
|
|
1318
1318
|
return filter;
|
|
1319
1319
|
},
|
|
1320
1320
|
set filter(value) {
|
|
1321
|
-
(0, utils_js_1.assertLogModeIsNotProduction)('set Reporter.filter');
|
|
1321
|
+
(0, utils_js_1.assertLogModeIsNotProduction)('set Reporter.filter', Object.getOwnPropertyDescriptor(this, 'filter').set);
|
|
1322
1322
|
filter = value;
|
|
1323
1323
|
},
|
|
1324
1324
|
logs: [],
|
|
@@ -1528,9 +1528,10 @@ var store_js_1 = __webpack_require__(/*! ./store.js */ "./ts/store.ts");
|
|
|
1528
1528
|
/**
|
|
1529
1529
|
* Helper function to assert the system is not in production mode.
|
|
1530
1530
|
*/
|
|
1531
|
-
|
|
1531
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
1532
|
+
function assertLogModeIsNotProduction(action, ssf) {
|
|
1532
1533
|
if (store_js_1.store.value.mode === 'production')
|
|
1533
|
-
throw new errors_js_1.ProhibitedDuringProduction(action);
|
|
1534
|
+
throw new errors_js_1.ProhibitedDuringProduction(action, { ssf: ssf });
|
|
1534
1535
|
}
|
|
1535
1536
|
exports.assertLogModeIsNotProduction = assertLogModeIsNotProduction;
|
|
1536
1537
|
|
|
Binary file
|