@skyux/core 8.0.0-alpha.3 → 8.0.0-alpha.5
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/documentation.json +586 -586
- package/esm2020/lib/modules/log/log.service.mjs +19 -8
- package/fesm2015/skyux-core.mjs +18 -7
- package/fesm2015/skyux-core.mjs.map +1 -1
- package/fesm2020/skyux-core.mjs +18 -7
- package/fesm2020/skyux-core.mjs.map +1 -1
- package/lib/modules/log/log.service.d.ts +11 -2
- package/package.json +2 -2
package/fesm2020/skyux-core.mjs
CHANGED
@@ -1506,9 +1506,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImpor
|
|
1506
1506
|
*/
|
1507
1507
|
const SKY_LOG_LEVEL = new InjectionToken('SkyLogLevel');
|
1508
1508
|
|
1509
|
-
var _SkyLogService_instances, _SkyLogService_applicationLogLevel, _SkyLogService_formatter,
|
1509
|
+
var _SkyLogService_instances, _SkyLogService_applicationLogLevel, _SkyLogService_formatter, _SkyLogService_convertStringToCode, _SkyLogService_canLog, _SkyLogService_logBasedOnLevel, _SkyLogService_logWithParams, _SkyLogService_buildMessageKey;
|
1510
|
+
const previousWarnings = new Set();
|
1510
1511
|
/**
|
1511
|
-
* Logs information to the console based on the application's log level as
|
1512
|
+
* Logs information to the console based on the application's log level as
|
1513
|
+
* provided by the `SKY_LOG_LEVEL` injection token. If no token is provided,
|
1514
|
+
* only `error` logs will be shown.
|
1512
1515
|
* @internal
|
1513
1516
|
*/
|
1514
1517
|
class SkyLogService {
|
@@ -1516,12 +1519,20 @@ class SkyLogService {
|
|
1516
1519
|
_SkyLogService_instances.add(this);
|
1517
1520
|
_SkyLogService_applicationLogLevel.set(this, void 0);
|
1518
1521
|
_SkyLogService_formatter.set(this, void 0);
|
1519
|
-
_SkyLogService_previousWarnings.set(this, new Set());
|
1520
1522
|
__classPrivateFieldSet(this, _SkyLogService_formatter, formatter, "f");
|
1521
1523
|
__classPrivateFieldSet(this, _SkyLogService_applicationLogLevel, applicationLogLevel ?? 3 /* SkyLogLevel.Error */, "f");
|
1522
1524
|
}
|
1523
1525
|
/**
|
1524
|
-
*
|
1526
|
+
* Clears previously-logged messages. Primarily used for unit
|
1527
|
+
* testing this service.
|
1528
|
+
*/
|
1529
|
+
static clearPreviousLogs() {
|
1530
|
+
previousWarnings.clear();
|
1531
|
+
}
|
1532
|
+
/**
|
1533
|
+
* Logs a deprecation warning for a class, property, function, etc. This will
|
1534
|
+
* be logged as a console warning unless a different log level is given in the
|
1535
|
+
* `args` parameter.
|
1525
1536
|
* @param name The name of the deprecated class, property, function, etc.
|
1526
1537
|
* @param args Information about the deprecation and replacement recommendations.
|
1527
1538
|
* @returns
|
@@ -1583,14 +1594,14 @@ class SkyLogService {
|
|
1583
1594
|
const messageKey = __classPrivateFieldGet(this, _SkyLogService_instances, "m", _SkyLogService_buildMessageKey).call(this, message, params);
|
1584
1595
|
// Only log each warning once per application instance to avoid drowning out other
|
1585
1596
|
// important messages in the console.
|
1586
|
-
if (!
|
1597
|
+
if (!previousWarnings.has(message)) {
|
1587
1598
|
__classPrivateFieldGet(this, _SkyLogService_instances, "m", _SkyLogService_logWithParams).call(this, 'warn', message, params);
|
1588
|
-
|
1599
|
+
previousWarnings.add(messageKey);
|
1589
1600
|
}
|
1590
1601
|
}
|
1591
1602
|
}
|
1592
1603
|
}
|
1593
|
-
_SkyLogService_applicationLogLevel = new WeakMap(), _SkyLogService_formatter = new WeakMap(),
|
1604
|
+
_SkyLogService_applicationLogLevel = new WeakMap(), _SkyLogService_formatter = new WeakMap(), _SkyLogService_instances = new WeakSet(), _SkyLogService_convertStringToCode = function _SkyLogService_convertStringToCode(typeString) {
|
1594
1605
|
if (typeString.charAt(0) !== '`' && typeString.charAt(-1) !== '`') {
|
1595
1606
|
typeString = '`' + typeString + '`';
|
1596
1607
|
}
|