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