@putkoff/abstract-logger 0.0.24 → 0.0.26

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
@@ -14472,12 +14472,16 @@ const IS_NODE = typeof process !== "undefined" &&
14472
14472
  const LOG_CONFIG = {
14473
14473
  condensed: process.env.LOG_CONDENSED !== "false",
14474
14474
  expandOnDebug: process.env.LOG_EXPAND_DEBUG !== "false",
14475
+ showDetails: process.env.LOG_SHOW_DETAILS !== "false",
14475
14476
  maxDetailsLength: Number(process.env.LOG_DETAILS_MAX ?? 500),
14476
14477
  /**
14477
14478
  * Function-level filtering
14478
14479
  * - empty allowlist = allow all
14479
14480
  * - blocklist always wins
14480
14481
  */
14482
+ showDetailslist: process.env.LOG_DETAILS_ALLOWLIST
14483
+ ? process.env.LOG_DETAILS_ALLOWLIST.split(",").map(s => s.trim())
14484
+ : [],
14481
14485
  functionAllowlist: process.env.LOG_FUNCTION_ALLOWLIST
14482
14486
  ? process.env.LOG_FUNCTION_ALLOWLIST.split(",").map(s => s.trim())
14483
14487
  : [],
@@ -14509,6 +14513,15 @@ function shouldCondense(logType) {
14509
14513
  }
14510
14514
  return LOG_CONFIG.condensed;
14511
14515
  }
14516
+ function shouldShowDetails(logType) {
14517
+ const allow = LOG_CONFIG.showDetailslist;
14518
+ // If allowlist exists, it RESTRICTS
14519
+ if (allow.length > 0) {
14520
+ return allow.includes(logType);
14521
+ }
14522
+ // Otherwise fall back to global flag
14523
+ return LOG_CONFIG.showDetails;
14524
+ }
14512
14525
  /** Exported logger */
14513
14526
  const logger = nodeLogger;
14514
14527
  /**
@@ -14667,12 +14680,13 @@ function getLogString(messageOrOptions, logType = null, details = null, function
14667
14680
  const emoji = emojiMap[finalLogType] ?? "ℹ️";
14668
14681
  const timestamp = new Date().toISOString();
14669
14682
  const condense = shouldCondense(finalLogType);
14683
+ const showDetails = shouldShowDetails(finalLogType);
14670
14684
  if (condense) {
14671
14685
  resolvedFileLocation = resolvedFileLocation.split("/").pop();
14672
14686
  }
14673
14687
  let line = `${emoji} [${timestamp}] [${resolvedFunctionName}] ${message}`;
14674
14688
  // ---------------- Details serialization ----------------
14675
- if (resolvedDetails !== null && resolvedDetails !== undefined) {
14689
+ if (showDetails && resolvedDetails !== null && resolvedDetails !== undefined) {
14676
14690
  const serialized = serializeDetails(resolvedDetails, condense, LOG_CONFIG.maxDetailsLength);
14677
14691
  line += ` | ${serialized}`;
14678
14692
  }