@putkoff/abstract-logger 0.0.31 → 0.0.32

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 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,20 @@ function getLogString(messageOrOptions, logType = null, details = null, function
14746
14757
  if (condense) {
14747
14758
  resolvedFileLocation = resolvedFileLocation.split("/").pop();
14748
14759
  }
14749
- let line = `${emoji} [${timestamp}] [${resolvedFunctionName}] ${message}`;
14760
+ const ts = padRight(timestamp, COLS.timestamp);
14761
+ const fn = padRight(resolvedFunctionName, COLS.function);
14762
+ const fileName = padLeft(resolvedFileLocation, COLS.file);
14763
+ let line = `${emoji} ` +
14764
+ `[${ts}] ` +
14765
+ `[${fn}] ` +
14766
+ `${message}`;
14750
14767
  // ---------------- Details serialization ----------------
14751
14768
  if (showDetails && resolvedDetails !== null && resolvedDetails !== undefined) {
14752
14769
  const LOG_CONFIG = getLogConfig();
14753
14770
  const serialized = serializeDetails(resolvedDetails, condense, LOG_CONFIG.maxDetailsLength);
14754
14771
  line += ` | ${serialized}`;
14755
14772
  }
14756
- line += ` | ${resolvedFileLocation}`;
14773
+ line += ` | ${fileName}`;
14757
14774
  // ---------------- Browser ----------------
14758
14775
  if (IS_BROWSER) {
14759
14776
  console[finalLogType === "error"