@putkoff/abstract-logger 0.0.38 â 0.0.40
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/cjs/index.js +16 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +16 -5
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -14759,9 +14759,21 @@ function shouldShowDetails(logType) {
|
|
|
14759
14759
|
}
|
|
14760
14760
|
return cfg.showDetails;
|
|
14761
14761
|
}
|
|
14762
|
-
function serializeDetails(value, condensed, maxLength, pretty
|
|
14763
|
-
) {
|
|
14762
|
+
function serializeDetails(value, condensed, maxLength, pretty) {
|
|
14764
14763
|
try {
|
|
14764
|
+
// đ DETECT STRINGIFIED JSON
|
|
14765
|
+
if (typeof value === "string") {
|
|
14766
|
+
const trimmed = value.trim();
|
|
14767
|
+
if ((trimmed.startsWith("{") && trimmed.endsWith("}")) ||
|
|
14768
|
+
(trimmed.startsWith("[") && trimmed.endsWith("]"))) {
|
|
14769
|
+
try {
|
|
14770
|
+
value = JSON.parse(trimmed);
|
|
14771
|
+
}
|
|
14772
|
+
catch {
|
|
14773
|
+
// fall through â leave as string
|
|
14774
|
+
}
|
|
14775
|
+
}
|
|
14776
|
+
}
|
|
14765
14777
|
const seen = new WeakSet();
|
|
14766
14778
|
const json = JSON.stringify(value, (key, val) => {
|
|
14767
14779
|
if (typeof val === "function")
|
|
@@ -14774,8 +14786,7 @@ function serializeDetails(value, condensed, maxLength, pretty // đ new
|
|
|
14774
14786
|
seen.add(val);
|
|
14775
14787
|
}
|
|
14776
14788
|
return val;
|
|
14777
|
-
}, pretty && !condensed ? 2 : 0
|
|
14778
|
-
);
|
|
14789
|
+
}, pretty && !condensed ? 2 : 0);
|
|
14779
14790
|
if (condensed && json.length > maxLength) {
|
|
14780
14791
|
return json.slice(0, maxLength) + "âĻ";
|
|
14781
14792
|
}
|
|
@@ -14881,7 +14892,7 @@ function getLogString(messageOrOptions, logType = null, details = null, function
|
|
|
14881
14892
|
resolvedFunctionName = resolveValue(resolvedFunctionName, caller.functionName);
|
|
14882
14893
|
resolvedFileLocation = resolveValue(resolvedFileLocation, caller.file);
|
|
14883
14894
|
const finalLogType = resolvedLogType ?? "info";
|
|
14884
|
-
const emoji = activityEmojiMap[
|
|
14895
|
+
const emoji = activityEmojiMap[resolvedLogType ?? ""] ??
|
|
14885
14896
|
"âšī¸";
|
|
14886
14897
|
const LOG_CONFIG = getLogConfig();
|
|
14887
14898
|
const condense = shouldCondense(finalLogType);
|