infront-logger 1.1.21 → 1.1.23
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/dist/index.es.js +34 -14
- package/dist/index.umd.js +34 -14
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -2681,18 +2681,35 @@ const TOKEN_STRING_RE = /"(access_token|refresh_token|id_token|bearer|authorizat
|
|
|
2681
2681
|
function redactString(str) {
|
|
2682
2682
|
return str.replace(JWT_RE, "*****").replace(TOKEN_STRING_RE, (_, key) => `"${key}":"*****"`);
|
|
2683
2683
|
}
|
|
2684
|
-
function
|
|
2684
|
+
function toSerializable(value) {
|
|
2685
|
+
if (typeof value.toJSON !== "function") return value;
|
|
2686
|
+
try {
|
|
2687
|
+
return value.toJSON();
|
|
2688
|
+
} catch (err) {
|
|
2689
|
+
return value;
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
function redact$3(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
2685
2693
|
if (value === null || value === void 0) return value;
|
|
2686
2694
|
if (typeof value === "string") return redactString(value);
|
|
2687
|
-
if (
|
|
2688
|
-
if (typeof value
|
|
2689
|
-
|
|
2695
|
+
if (typeof value === "function") return void 0;
|
|
2696
|
+
if (typeof value !== "object") return value;
|
|
2697
|
+
if (seen.has(value)) return "[Circular]";
|
|
2698
|
+
seen.add(value);
|
|
2699
|
+
let out;
|
|
2700
|
+
const serializable = toSerializable(value);
|
|
2701
|
+
if (serializable !== value) {
|
|
2702
|
+
out = redact$3(serializable, seen);
|
|
2703
|
+
} else if (Array.isArray(value)) {
|
|
2704
|
+
out = value.map((item) => redact$3(item, seen));
|
|
2705
|
+
} else {
|
|
2706
|
+
out = {};
|
|
2690
2707
|
for (const k of Object.keys(value)) {
|
|
2691
|
-
out[k] = SENSITIVE_KEYS.has(k.toLowerCase()) ? "*****" : redact$3(value[k]);
|
|
2708
|
+
out[k] = SENSITIVE_KEYS.has(k.toLowerCase()) ? "*****" : redact$3(value[k], seen);
|
|
2692
2709
|
}
|
|
2693
|
-
return out;
|
|
2694
2710
|
}
|
|
2695
|
-
|
|
2711
|
+
seen.delete(value);
|
|
2712
|
+
return out;
|
|
2696
2713
|
}
|
|
2697
2714
|
const transportCache = /* @__PURE__ */ new Map();
|
|
2698
2715
|
class CoralogixTransport extends Transport {
|
|
@@ -2723,13 +2740,16 @@ class CoralogixTransport extends Transport {
|
|
|
2723
2740
|
}
|
|
2724
2741
|
log(info, callback) {
|
|
2725
2742
|
setImmediate(() => this.emit("logged", info));
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2743
|
+
try {
|
|
2744
|
+
const sanitized = redact$3(info);
|
|
2745
|
+
this.queue.push({
|
|
2746
|
+
severity: SEVERITY[info.level] || SEVERITY.info,
|
|
2747
|
+
timestamp: Date.now(),
|
|
2748
|
+
text: JSON.stringify(sanitized)
|
|
2749
|
+
});
|
|
2750
|
+
if (this.queue.length >= this.batchCount) this.flush();
|
|
2751
|
+
} catch (err) {
|
|
2752
|
+
}
|
|
2733
2753
|
if (callback) callback();
|
|
2734
2754
|
}
|
|
2735
2755
|
flush() {
|
package/dist/index.umd.js
CHANGED
|
@@ -2682,18 +2682,35 @@
|
|
|
2682
2682
|
function redactString(str) {
|
|
2683
2683
|
return str.replace(JWT_RE, "*****").replace(TOKEN_STRING_RE, (_, key) => `"${key}":"*****"`);
|
|
2684
2684
|
}
|
|
2685
|
-
function
|
|
2685
|
+
function toSerializable(value) {
|
|
2686
|
+
if (typeof value.toJSON !== "function") return value;
|
|
2687
|
+
try {
|
|
2688
|
+
return value.toJSON();
|
|
2689
|
+
} catch (err) {
|
|
2690
|
+
return value;
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
function redact$3(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
2686
2694
|
if (value === null || value === void 0) return value;
|
|
2687
2695
|
if (typeof value === "string") return redactString(value);
|
|
2688
|
-
if (
|
|
2689
|
-
if (typeof value
|
|
2690
|
-
|
|
2696
|
+
if (typeof value === "function") return void 0;
|
|
2697
|
+
if (typeof value !== "object") return value;
|
|
2698
|
+
if (seen.has(value)) return "[Circular]";
|
|
2699
|
+
seen.add(value);
|
|
2700
|
+
let out;
|
|
2701
|
+
const serializable = toSerializable(value);
|
|
2702
|
+
if (serializable !== value) {
|
|
2703
|
+
out = redact$3(serializable, seen);
|
|
2704
|
+
} else if (Array.isArray(value)) {
|
|
2705
|
+
out = value.map((item) => redact$3(item, seen));
|
|
2706
|
+
} else {
|
|
2707
|
+
out = {};
|
|
2691
2708
|
for (const k of Object.keys(value)) {
|
|
2692
|
-
out[k] = SENSITIVE_KEYS.has(k.toLowerCase()) ? "*****" : redact$3(value[k]);
|
|
2709
|
+
out[k] = SENSITIVE_KEYS.has(k.toLowerCase()) ? "*****" : redact$3(value[k], seen);
|
|
2693
2710
|
}
|
|
2694
|
-
return out;
|
|
2695
2711
|
}
|
|
2696
|
-
|
|
2712
|
+
seen.delete(value);
|
|
2713
|
+
return out;
|
|
2697
2714
|
}
|
|
2698
2715
|
const transportCache = /* @__PURE__ */ new Map();
|
|
2699
2716
|
class CoralogixTransport extends Transport {
|
|
@@ -2724,13 +2741,16 @@
|
|
|
2724
2741
|
}
|
|
2725
2742
|
log(info, callback) {
|
|
2726
2743
|
setImmediate(() => this.emit("logged", info));
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2744
|
+
try {
|
|
2745
|
+
const sanitized = redact$3(info);
|
|
2746
|
+
this.queue.push({
|
|
2747
|
+
severity: SEVERITY[info.level] || SEVERITY.info,
|
|
2748
|
+
timestamp: Date.now(),
|
|
2749
|
+
text: JSON.stringify(sanitized)
|
|
2750
|
+
});
|
|
2751
|
+
if (this.queue.length >= this.batchCount) this.flush();
|
|
2752
|
+
} catch (err) {
|
|
2753
|
+
}
|
|
2734
2754
|
if (callback) callback();
|
|
2735
2755
|
}
|
|
2736
2756
|
flush() {
|