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