infront-logger 1.1.21 → 1.1.22

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 CHANGED
@@ -2681,18 +2681,23 @@ 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 redact$3(value) {
2684
+ function redact$3(value, seen = /* @__PURE__ */ new WeakSet()) {
2685
2685
  if (value === null || value === void 0) return value;
2686
2686
  if (typeof value === "string") return redactString(value);
2687
- if (Array.isArray(value)) return value.map(redact$3);
2688
- if (typeof value === "object") {
2689
- const out = {};
2687
+ if (typeof value !== "object") return value;
2688
+ if (seen.has(value)) return "[Circular]";
2689
+ seen.add(value);
2690
+ let out;
2691
+ if (Array.isArray(value)) {
2692
+ out = value.map((item) => redact$3(item, seen));
2693
+ } else {
2694
+ out = {};
2690
2695
  for (const k of Object.keys(value)) {
2691
- out[k] = SENSITIVE_KEYS.has(k.toLowerCase()) ? "*****" : redact$3(value[k]);
2696
+ out[k] = SENSITIVE_KEYS.has(k.toLowerCase()) ? "*****" : redact$3(value[k], seen);
2692
2697
  }
2693
- return out;
2694
2698
  }
2695
- return value;
2699
+ seen.delete(value);
2700
+ return out;
2696
2701
  }
2697
2702
  const transportCache = /* @__PURE__ */ new Map();
2698
2703
  class CoralogixTransport extends Transport {
@@ -2723,13 +2728,16 @@ class CoralogixTransport extends Transport {
2723
2728
  }
2724
2729
  log(info, callback) {
2725
2730
  setImmediate(() => this.emit("logged", info));
2726
- const sanitized = redact$3(info);
2727
- this.queue.push({
2728
- severity: SEVERITY[info.level] || SEVERITY.info,
2729
- timestamp: Date.now(),
2730
- text: JSON.stringify(sanitized)
2731
- });
2732
- if (this.queue.length >= this.batchCount) this.flush();
2731
+ try {
2732
+ const sanitized = redact$3(info);
2733
+ this.queue.push({
2734
+ severity: SEVERITY[info.level] || SEVERITY.info,
2735
+ timestamp: Date.now(),
2736
+ text: JSON.stringify(sanitized)
2737
+ });
2738
+ if (this.queue.length >= this.batchCount) this.flush();
2739
+ } catch (err) {
2740
+ }
2733
2741
  if (callback) callback();
2734
2742
  }
2735
2743
  flush() {
package/dist/index.umd.js CHANGED
@@ -2682,18 +2682,23 @@
2682
2682
  function redactString(str) {
2683
2683
  return str.replace(JWT_RE, "*****").replace(TOKEN_STRING_RE, (_, key) => `"${key}":"*****"`);
2684
2684
  }
2685
- function redact$3(value) {
2685
+ function redact$3(value, seen = /* @__PURE__ */ new WeakSet()) {
2686
2686
  if (value === null || value === void 0) return value;
2687
2687
  if (typeof value === "string") return redactString(value);
2688
- if (Array.isArray(value)) return value.map(redact$3);
2689
- if (typeof value === "object") {
2690
- const out = {};
2688
+ if (typeof value !== "object") return value;
2689
+ if (seen.has(value)) return "[Circular]";
2690
+ seen.add(value);
2691
+ let out;
2692
+ if (Array.isArray(value)) {
2693
+ out = value.map((item) => redact$3(item, seen));
2694
+ } else {
2695
+ out = {};
2691
2696
  for (const k of Object.keys(value)) {
2692
- out[k] = SENSITIVE_KEYS.has(k.toLowerCase()) ? "*****" : redact$3(value[k]);
2697
+ out[k] = SENSITIVE_KEYS.has(k.toLowerCase()) ? "*****" : redact$3(value[k], seen);
2693
2698
  }
2694
- return out;
2695
2699
  }
2696
- return value;
2700
+ seen.delete(value);
2701
+ return out;
2697
2702
  }
2698
2703
  const transportCache = /* @__PURE__ */ new Map();
2699
2704
  class CoralogixTransport extends Transport {
@@ -2724,13 +2729,16 @@
2724
2729
  }
2725
2730
  log(info, callback) {
2726
2731
  setImmediate(() => this.emit("logged", info));
2727
- const sanitized = redact$3(info);
2728
- this.queue.push({
2729
- severity: SEVERITY[info.level] || SEVERITY.info,
2730
- timestamp: Date.now(),
2731
- text: JSON.stringify(sanitized)
2732
- });
2733
- if (this.queue.length >= this.batchCount) this.flush();
2732
+ try {
2733
+ const sanitized = redact$3(info);
2734
+ this.queue.push({
2735
+ severity: SEVERITY[info.level] || SEVERITY.info,
2736
+ timestamp: Date.now(),
2737
+ text: JSON.stringify(sanitized)
2738
+ });
2739
+ if (this.queue.length >= this.batchCount) this.flush();
2740
+ } catch (err) {
2741
+ }
2734
2742
  if (callback) callback();
2735
2743
  }
2736
2744
  flush() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "infront-logger",
3
- "version": "1.1.21",
3
+ "version": "1.1.22",
4
4
  "description": "",
5
5
  "files": [
6
6
  "dist"