@putkoff/abstract-logger 0.0.31 → 0.0.33
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 +20 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +20 -2
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -14545,6 +14545,17 @@ function resolveValue(...values) {
|
|
|
14545
14545
|
/* ------------------------------------------------------------------ */
|
|
14546
14546
|
/* Stack inspection */
|
|
14547
14547
|
/* ------------------------------------------------------------------ */
|
|
14548
|
+
function padRight(str, width) {
|
|
14549
|
+
return str.length >= width ? str : str + " ".repeat(width - str.length);
|
|
14550
|
+
}
|
|
14551
|
+
function padLeft(str, width) {
|
|
14552
|
+
return str.length >= width ? str : " ".repeat(width - str.length) + str;
|
|
14553
|
+
}
|
|
14554
|
+
const COLS = {
|
|
14555
|
+
timestamp: 24,
|
|
14556
|
+
function: 28,
|
|
14557
|
+
file: 16,
|
|
14558
|
+
};
|
|
14548
14559
|
/* ------------------------------------------------------------------ */
|
|
14549
14560
|
/* Stack inspection */
|
|
14550
14561
|
/* ------------------------------------------------------------------ */
|
|
@@ -14746,14 +14757,21 @@ function getLogString(messageOrOptions, logType = null, details = null, function
|
|
|
14746
14757
|
if (condense) {
|
|
14747
14758
|
resolvedFileLocation = resolvedFileLocation.split("/").pop();
|
|
14748
14759
|
}
|
|
14749
|
-
|
|
14760
|
+
const emojiCol = padRight(emoji, 3);
|
|
14761
|
+
const ts = padRight(timestamp, COLS.timestamp);
|
|
14762
|
+
const fn = padRight(resolvedFunctionName.trim(), COLS.function);
|
|
14763
|
+
const fileName = padLeft(resolvedFileLocation, COLS.file);
|
|
14764
|
+
let line = `${emojiCol}` +
|
|
14765
|
+
`[${ts}] ` +
|
|
14766
|
+
`[${fn}] ` +
|
|
14767
|
+
`${message}`;
|
|
14750
14768
|
// ---------------- Details serialization ----------------
|
|
14751
14769
|
if (showDetails && resolvedDetails !== null && resolvedDetails !== undefined) {
|
|
14752
14770
|
const LOG_CONFIG = getLogConfig();
|
|
14753
14771
|
const serialized = serializeDetails(resolvedDetails, condense, LOG_CONFIG.maxDetailsLength);
|
|
14754
14772
|
line += ` | ${serialized}`;
|
|
14755
14773
|
}
|
|
14756
|
-
line += ` | ${
|
|
14774
|
+
line += ` | ${fileName}`;
|
|
14757
14775
|
// ---------------- Browser ----------------
|
|
14758
14776
|
if (IS_BROWSER) {
|
|
14759
14777
|
console[finalLogType === "error"
|