befly 3.11.1 → 3.12.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/dist/befly.js +19 -19
- package/dist/befly.min.js +8 -8
- package/dist/lib/logger.js +19 -19
- package/package.json +3 -6
package/dist/befly.js
CHANGED
|
@@ -825,7 +825,7 @@ function buildLogLine(level, args) {
|
|
|
825
825
|
`;
|
|
826
826
|
}
|
|
827
827
|
if (first instanceof Error) {
|
|
828
|
-
base.err = sanitizeErrorValue(first
|
|
828
|
+
base.err = sanitizeErrorValue(first);
|
|
829
829
|
if (typeof second === "string") {
|
|
830
830
|
const extraMsg = formatExtrasToMsg(args.slice(2));
|
|
831
831
|
base.msg = extraMsg ? `${second} ${extraMsg}` : second;
|
|
@@ -882,7 +882,7 @@ function createSinkLogger(options) {
|
|
|
882
882
|
}
|
|
883
883
|
};
|
|
884
884
|
}
|
|
885
|
-
function truncateString(val
|
|
885
|
+
function truncateString(val) {
|
|
886
886
|
if (val.length <= maxLogStringLen)
|
|
887
887
|
return val;
|
|
888
888
|
return val.slice(0, maxLogStringLen);
|
|
@@ -900,7 +900,7 @@ function isSensitiveKey(key) {
|
|
|
900
900
|
}
|
|
901
901
|
return false;
|
|
902
902
|
}
|
|
903
|
-
function safeToStringMasked(val, visited
|
|
903
|
+
function safeToStringMasked(val, visited) {
|
|
904
904
|
if (typeof val === "string")
|
|
905
905
|
return val;
|
|
906
906
|
if (val instanceof Error) {
|
|
@@ -946,25 +946,25 @@ function safeToStringMasked(val, visited, stats) {
|
|
|
946
946
|
}
|
|
947
947
|
}
|
|
948
948
|
}
|
|
949
|
-
function sanitizeErrorValue(err
|
|
949
|
+
function sanitizeErrorValue(err) {
|
|
950
950
|
const errObj = {
|
|
951
951
|
name: err.name || "Error",
|
|
952
|
-
message: truncateString(err.message || ""
|
|
952
|
+
message: truncateString(err.message || "")
|
|
953
953
|
};
|
|
954
954
|
if (typeof err.stack === "string") {
|
|
955
|
-
errObj.stack = truncateString(err.stack
|
|
955
|
+
errObj.stack = truncateString(err.stack);
|
|
956
956
|
}
|
|
957
957
|
return errObj;
|
|
958
958
|
}
|
|
959
|
-
function stringifyPreview(val, visited
|
|
960
|
-
const str = safeToStringMasked(val, visited
|
|
961
|
-
return truncateString(str
|
|
959
|
+
function stringifyPreview(val, visited) {
|
|
960
|
+
const str = safeToStringMasked(val, visited);
|
|
961
|
+
return truncateString(str);
|
|
962
962
|
}
|
|
963
|
-
function sanitizeValueLimited(val, visited
|
|
963
|
+
function sanitizeValueLimited(val, visited) {
|
|
964
964
|
if (val === null || val === undefined)
|
|
965
965
|
return val;
|
|
966
966
|
if (typeof val === "string")
|
|
967
|
-
return truncateString(val
|
|
967
|
+
return truncateString(val);
|
|
968
968
|
if (typeof val === "number")
|
|
969
969
|
return val;
|
|
970
970
|
if (typeof val === "boolean")
|
|
@@ -972,12 +972,12 @@ function sanitizeValueLimited(val, visited, stats) {
|
|
|
972
972
|
if (typeof val === "bigint")
|
|
973
973
|
return val;
|
|
974
974
|
if (val instanceof Error) {
|
|
975
|
-
return sanitizeErrorValue(val
|
|
975
|
+
return sanitizeErrorValue(val);
|
|
976
976
|
}
|
|
977
977
|
const isArr = Array.isArray(val);
|
|
978
978
|
const isObj = isPlainObject(val);
|
|
979
979
|
if (!isArr && !isObj) {
|
|
980
|
-
return stringifyPreview(val, visited
|
|
980
|
+
return stringifyPreview(val, visited);
|
|
981
981
|
}
|
|
982
982
|
if (visited.has(val)) {
|
|
983
983
|
return "[Circular]";
|
|
@@ -992,7 +992,7 @@ function sanitizeValueLimited(val, visited, stats) {
|
|
|
992
992
|
return;
|
|
993
993
|
}
|
|
994
994
|
if (typeof child === "string") {
|
|
995
|
-
dst[key] = truncateString(child
|
|
995
|
+
dst[key] = truncateString(child);
|
|
996
996
|
return;
|
|
997
997
|
}
|
|
998
998
|
if (typeof child === "number" || typeof child === "boolean" || typeof child === "bigint") {
|
|
@@ -1000,21 +1000,21 @@ function sanitizeValueLimited(val, visited, stats) {
|
|
|
1000
1000
|
return;
|
|
1001
1001
|
}
|
|
1002
1002
|
if (child instanceof Error) {
|
|
1003
|
-
dst[key] = sanitizeErrorValue(child
|
|
1003
|
+
dst[key] = sanitizeErrorValue(child);
|
|
1004
1004
|
return;
|
|
1005
1005
|
}
|
|
1006
1006
|
const childIsArr = Array.isArray(child);
|
|
1007
1007
|
const childIsObj = isPlainObject(child);
|
|
1008
1008
|
if (!childIsArr && !childIsObj) {
|
|
1009
|
-
dst[key] = stringifyPreview(child, visited
|
|
1009
|
+
dst[key] = stringifyPreview(child, visited);
|
|
1010
1010
|
return;
|
|
1011
1011
|
}
|
|
1012
1012
|
if (depth >= sanitizeDepthLimit) {
|
|
1013
|
-
dst[key] = stringifyPreview(child, visited
|
|
1013
|
+
dst[key] = stringifyPreview(child, visited);
|
|
1014
1014
|
return;
|
|
1015
1015
|
}
|
|
1016
1016
|
if (nodes >= sanitizeNodesLimit) {
|
|
1017
|
-
dst[key] = stringifyPreview(child, visited
|
|
1017
|
+
dst[key] = stringifyPreview(child, visited);
|
|
1018
1018
|
return;
|
|
1019
1019
|
}
|
|
1020
1020
|
if (visited.has(child)) {
|
|
@@ -1062,7 +1062,7 @@ function sanitizeValueLimited(val, visited, stats) {
|
|
|
1062
1062
|
return rootOut;
|
|
1063
1063
|
}
|
|
1064
1064
|
function sanitizeTopValue(val, visited) {
|
|
1065
|
-
return sanitizeValueLimited(val, visited
|
|
1065
|
+
return sanitizeValueLimited(val, visited);
|
|
1066
1066
|
}
|
|
1067
1067
|
function sanitizeLogObject(obj) {
|
|
1068
1068
|
const visited = new WeakSet;
|