@putkoff/abstract-logger 0.0.20 → 0.0.22

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
@@ -14473,6 +14473,17 @@ const LOG_CONFIG = {
14473
14473
  condensed: process.env.LOG_CONDENSED !== "false",
14474
14474
  expandOnDebug: process.env.LOG_EXPAND_DEBUG !== "false",
14475
14475
  maxDetailsLength: Number(process.env.LOG_DETAILS_MAX ?? 500),
14476
+ /**
14477
+ * Function-level filtering
14478
+ * - empty allowlist = allow all
14479
+ * - blocklist always wins
14480
+ */
14481
+ functionAllowlist: process.env.LOG_FUNCTION_ALLOWLIST
14482
+ ? process.env.LOG_FUNCTION_ALLOWLIST.split(",").map(s => s.trim())
14483
+ : [],
14484
+ functionBlocklist: process.env.LOG_FUNCTION_BLOCKLIST
14485
+ ? process.env.LOG_FUNCTION_BLOCKLIST.split(",").map(s => s.trim())
14486
+ : [],
14476
14487
  };
14477
14488
 
14478
14489
  /* ------------------------------------------------------------------ */
@@ -14628,9 +14639,17 @@ function getLogString(messageOrOptions, logType = null, details = null, function
14628
14639
  let { message, logType: resolvedLogType, details: resolvedDetails, function_name: resolvedFunctionName, file_location: resolvedFileLocation, consumerLogger: resolvedLoggerInput, } = opts;
14629
14640
  // ---------------- Resolve caller info ----------------
14630
14641
  const { functionName, file } = getCallerInfo();
14631
- resolvedFunctionName = resolveValue(functionName !== "unknown" ? functionName : null, resolvedFunctionName);
14632
- resolvedFileLocation = resolveValue(file !== "unknown" ? file : null, resolvedFileLocation);
14642
+ // ---------------- Resolve caller info ----------------
14643
+ if (!resolvedFunctionName || resolvedFunctionName === "unknown") {
14644
+ const { functionName } = getCallerInfo();
14645
+ resolvedFunctionName = resolveValue(functionName, resolvedFunctionName);
14646
+ }
14647
+ if (!resolvedFileLocation || resolvedFileLocation === "unknown") {
14648
+ const { file } = getCallerInfo();
14649
+ resolvedFileLocation = resolveValue(file, resolvedFileLocation);
14650
+ }
14633
14651
  const emojiMap = {
14652
+ success: "✅",
14634
14653
  info: "ℹ️",
14635
14654
  warn: "⚠️",
14636
14655
  error: "❌",
@@ -14640,7 +14659,7 @@ function getLogString(messageOrOptions, logType = null, details = null, function
14640
14659
  const emoji = emojiMap[finalLogType] ?? "ℹ️";
14641
14660
  const timestamp = new Date().toISOString();
14642
14661
  const condense = shouldCondense(finalLogType);
14643
- if (condense && typeof resolvedFileLocation === "string") {
14662
+ if (condense) {
14644
14663
  resolvedFileLocation = resolvedFileLocation.split("/").pop();
14645
14664
  }
14646
14665
  let line = `${emoji} [${timestamp}] [${resolvedFunctionName}] ${message}`;