infront-logger 1.1.23 → 1.1.25
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 +39 -20
- package/dist/index.umd.js +39 -20
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -366,7 +366,7 @@ function requireBuffer_list() {
|
|
|
366
366
|
if (typeof res !== "object") return res;
|
|
367
367
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
368
368
|
}
|
|
369
|
-
return String(input);
|
|
369
|
+
return (hint === "string" ? String : Number)(input);
|
|
370
370
|
}
|
|
371
371
|
var _require2 = require$$2, Buffer2 = _require2.Buffer;
|
|
372
372
|
var _require22 = require$$0$1, inspect2 = _require22.inspect;
|
|
@@ -2681,7 +2681,7 @@ 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 toSerializable(value) {
|
|
2684
|
+
function toSerializable$1(value) {
|
|
2685
2685
|
if (typeof value.toJSON !== "function") return value;
|
|
2686
2686
|
try {
|
|
2687
2687
|
return value.toJSON();
|
|
@@ -2697,7 +2697,7 @@ function redact$3(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
|
2697
2697
|
if (seen.has(value)) return "[Circular]";
|
|
2698
2698
|
seen.add(value);
|
|
2699
2699
|
let out;
|
|
2700
|
-
const serializable = toSerializable(value);
|
|
2700
|
+
const serializable = toSerializable$1(value);
|
|
2701
2701
|
if (serializable !== value) {
|
|
2702
2702
|
out = redact$3(serializable, seen);
|
|
2703
2703
|
} else if (Array.isArray(value)) {
|
|
@@ -2714,7 +2714,7 @@ function redact$3(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
|
2714
2714
|
const transportCache = /* @__PURE__ */ new Map();
|
|
2715
2715
|
class CoralogixTransport extends Transport {
|
|
2716
2716
|
static getOrCreate(opts = {}) {
|
|
2717
|
-
const key = `${opts.applicationName}|${opts.subsystemName}|${opts.apiKey}|${opts.domain || "us2.coralogix.com"}`;
|
|
2717
|
+
const key = `${opts.applicationName}|${opts.subsystemName}|${opts.apiKey}|${opts.domain || "us2.coralogix.com"}|${JSON.stringify(opts.labels || {})}`;
|
|
2718
2718
|
let instance = transportCache.get(key);
|
|
2719
2719
|
if (!instance) {
|
|
2720
2720
|
instance = new CoralogixTransport(opts);
|
|
@@ -2727,6 +2727,7 @@ class CoralogixTransport extends Transport {
|
|
|
2727
2727
|
this.applicationName = opts.applicationName;
|
|
2728
2728
|
this.subsystemName = opts.subsystemName;
|
|
2729
2729
|
this.apiKey = opts.apiKey;
|
|
2730
|
+
this.labels = opts.labels || {};
|
|
2730
2731
|
this.cxDomain = opts.domain || "us2.coralogix.com";
|
|
2731
2732
|
this.host = `ingress.${this.cxDomain}`;
|
|
2732
2733
|
this.path = opts.path || "/logs/v1/bulk";
|
|
@@ -2745,7 +2746,7 @@ class CoralogixTransport extends Transport {
|
|
|
2745
2746
|
this.queue.push({
|
|
2746
2747
|
severity: SEVERITY[info.level] || SEVERITY.info,
|
|
2747
2748
|
timestamp: Date.now(),
|
|
2748
|
-
text: JSON.stringify(sanitized)
|
|
2749
|
+
text: JSON.stringify({ ...sanitized, ...this.labels })
|
|
2749
2750
|
});
|
|
2750
2751
|
if (this.queue.length >= this.batchCount) this.flush();
|
|
2751
2752
|
} catch (err) {
|
|
@@ -2975,26 +2976,44 @@ class Logger {
|
|
|
2975
2976
|
loggerCache.set(cacheKey, this.logger);
|
|
2976
2977
|
}
|
|
2977
2978
|
}
|
|
2979
|
+
const toSerializable = (value) => {
|
|
2980
|
+
if (typeof value.toJSON !== "function") return value;
|
|
2981
|
+
try {
|
|
2982
|
+
return value.toJSON();
|
|
2983
|
+
} catch (err) {
|
|
2984
|
+
return value;
|
|
2985
|
+
}
|
|
2986
|
+
};
|
|
2978
2987
|
const redact$2 = (data, ...sensitiveKeysList) => {
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
if (
|
|
2982
|
-
return
|
|
2983
|
-
}
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2988
|
+
const walk = (value, seen) => {
|
|
2989
|
+
var _a, _b;
|
|
2990
|
+
if (typeof value !== "object" || value === null || ((_b = (_a = value == null ? void 0 : value.constructor) == null ? void 0 : _a.name) == null ? void 0 : _b.startsWith("model"))) {
|
|
2991
|
+
return value;
|
|
2992
|
+
}
|
|
2993
|
+
if (seen.has(value)) return "[Circular]";
|
|
2994
|
+
seen.add(value);
|
|
2995
|
+
let redactedData;
|
|
2996
|
+
const serializable = toSerializable(value);
|
|
2997
|
+
if (serializable !== value) {
|
|
2998
|
+
redactedData = walk(serializable, seen);
|
|
2999
|
+
} else if (Array.isArray(value)) {
|
|
3000
|
+
redactedData = Array.from(value, (item) => walk(item, seen));
|
|
3001
|
+
} else {
|
|
3002
|
+
redactedData = {};
|
|
3003
|
+
for (const key in value) {
|
|
3004
|
+
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
|
3005
|
+
if (sensitiveKeysList.includes(key)) {
|
|
3006
|
+
redactedData[key] = "*****";
|
|
3007
|
+
} else {
|
|
3008
|
+
redactedData[key] = walk(value[key], seen);
|
|
3009
|
+
}
|
|
2991
3010
|
}
|
|
2992
3011
|
}
|
|
2993
3012
|
}
|
|
3013
|
+
seen.delete(value);
|
|
2994
3014
|
return redactedData;
|
|
2995
|
-
}
|
|
2996
|
-
|
|
2997
|
-
}
|
|
3015
|
+
};
|
|
3016
|
+
return walk(data, /* @__PURE__ */ new WeakSet());
|
|
2998
3017
|
};
|
|
2999
3018
|
const trim$2 = (data, length) => {
|
|
3000
3019
|
try {
|
package/dist/index.umd.js
CHANGED
|
@@ -367,7 +367,7 @@
|
|
|
367
367
|
if (typeof res !== "object") return res;
|
|
368
368
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
369
369
|
}
|
|
370
|
-
return String(input);
|
|
370
|
+
return (hint === "string" ? String : Number)(input);
|
|
371
371
|
}
|
|
372
372
|
var _require2 = require$$2, Buffer2 = _require2.Buffer;
|
|
373
373
|
var _require22 = require$$0$1, inspect2 = _require22.inspect;
|
|
@@ -2682,7 +2682,7 @@
|
|
|
2682
2682
|
function redactString(str) {
|
|
2683
2683
|
return str.replace(JWT_RE, "*****").replace(TOKEN_STRING_RE, (_, key) => `"${key}":"*****"`);
|
|
2684
2684
|
}
|
|
2685
|
-
function toSerializable(value) {
|
|
2685
|
+
function toSerializable$1(value) {
|
|
2686
2686
|
if (typeof value.toJSON !== "function") return value;
|
|
2687
2687
|
try {
|
|
2688
2688
|
return value.toJSON();
|
|
@@ -2698,7 +2698,7 @@
|
|
|
2698
2698
|
if (seen.has(value)) return "[Circular]";
|
|
2699
2699
|
seen.add(value);
|
|
2700
2700
|
let out;
|
|
2701
|
-
const serializable = toSerializable(value);
|
|
2701
|
+
const serializable = toSerializable$1(value);
|
|
2702
2702
|
if (serializable !== value) {
|
|
2703
2703
|
out = redact$3(serializable, seen);
|
|
2704
2704
|
} else if (Array.isArray(value)) {
|
|
@@ -2715,7 +2715,7 @@
|
|
|
2715
2715
|
const transportCache = /* @__PURE__ */ new Map();
|
|
2716
2716
|
class CoralogixTransport extends Transport {
|
|
2717
2717
|
static getOrCreate(opts = {}) {
|
|
2718
|
-
const key = `${opts.applicationName}|${opts.subsystemName}|${opts.apiKey}|${opts.domain || "us2.coralogix.com"}`;
|
|
2718
|
+
const key = `${opts.applicationName}|${opts.subsystemName}|${opts.apiKey}|${opts.domain || "us2.coralogix.com"}|${JSON.stringify(opts.labels || {})}`;
|
|
2719
2719
|
let instance = transportCache.get(key);
|
|
2720
2720
|
if (!instance) {
|
|
2721
2721
|
instance = new CoralogixTransport(opts);
|
|
@@ -2728,6 +2728,7 @@
|
|
|
2728
2728
|
this.applicationName = opts.applicationName;
|
|
2729
2729
|
this.subsystemName = opts.subsystemName;
|
|
2730
2730
|
this.apiKey = opts.apiKey;
|
|
2731
|
+
this.labels = opts.labels || {};
|
|
2731
2732
|
this.cxDomain = opts.domain || "us2.coralogix.com";
|
|
2732
2733
|
this.host = `ingress.${this.cxDomain}`;
|
|
2733
2734
|
this.path = opts.path || "/logs/v1/bulk";
|
|
@@ -2746,7 +2747,7 @@
|
|
|
2746
2747
|
this.queue.push({
|
|
2747
2748
|
severity: SEVERITY[info.level] || SEVERITY.info,
|
|
2748
2749
|
timestamp: Date.now(),
|
|
2749
|
-
text: JSON.stringify(sanitized)
|
|
2750
|
+
text: JSON.stringify({ ...sanitized, ...this.labels })
|
|
2750
2751
|
});
|
|
2751
2752
|
if (this.queue.length >= this.batchCount) this.flush();
|
|
2752
2753
|
} catch (err) {
|
|
@@ -2976,26 +2977,44 @@
|
|
|
2976
2977
|
loggerCache.set(cacheKey, this.logger);
|
|
2977
2978
|
}
|
|
2978
2979
|
}
|
|
2980
|
+
const toSerializable = (value) => {
|
|
2981
|
+
if (typeof value.toJSON !== "function") return value;
|
|
2982
|
+
try {
|
|
2983
|
+
return value.toJSON();
|
|
2984
|
+
} catch (err) {
|
|
2985
|
+
return value;
|
|
2986
|
+
}
|
|
2987
|
+
};
|
|
2979
2988
|
const redact$2 = (data, ...sensitiveKeysList) => {
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
if (
|
|
2983
|
-
return
|
|
2984
|
-
}
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2989
|
+
const walk = (value, seen) => {
|
|
2990
|
+
var _a, _b;
|
|
2991
|
+
if (typeof value !== "object" || value === null || ((_b = (_a = value == null ? void 0 : value.constructor) == null ? void 0 : _a.name) == null ? void 0 : _b.startsWith("model"))) {
|
|
2992
|
+
return value;
|
|
2993
|
+
}
|
|
2994
|
+
if (seen.has(value)) return "[Circular]";
|
|
2995
|
+
seen.add(value);
|
|
2996
|
+
let redactedData;
|
|
2997
|
+
const serializable = toSerializable(value);
|
|
2998
|
+
if (serializable !== value) {
|
|
2999
|
+
redactedData = walk(serializable, seen);
|
|
3000
|
+
} else if (Array.isArray(value)) {
|
|
3001
|
+
redactedData = Array.from(value, (item) => walk(item, seen));
|
|
3002
|
+
} else {
|
|
3003
|
+
redactedData = {};
|
|
3004
|
+
for (const key in value) {
|
|
3005
|
+
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
|
3006
|
+
if (sensitiveKeysList.includes(key)) {
|
|
3007
|
+
redactedData[key] = "*****";
|
|
3008
|
+
} else {
|
|
3009
|
+
redactedData[key] = walk(value[key], seen);
|
|
3010
|
+
}
|
|
2992
3011
|
}
|
|
2993
3012
|
}
|
|
2994
3013
|
}
|
|
3014
|
+
seen.delete(value);
|
|
2995
3015
|
return redactedData;
|
|
2996
|
-
}
|
|
2997
|
-
|
|
2998
|
-
}
|
|
3016
|
+
};
|
|
3017
|
+
return walk(data, /* @__PURE__ */ new WeakSet());
|
|
2999
3018
|
};
|
|
3000
3019
|
const trim$2 = (data, length) => {
|
|
3001
3020
|
try {
|