@putkoff/abstract-logger 0.0.26 → 0.0.28

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.
@@ -1,13 +1,8 @@
1
- export declare const LOG_CONFIG: {
1
+ export declare function getLogConfig(): {
2
2
  condensed: boolean;
3
3
  expandOnDebug: boolean;
4
4
  showDetails: boolean;
5
5
  maxDetailsLength: number;
6
- /**
7
- * Function-level filtering
8
- * - empty allowlist = allow all
9
- * - blocklist always wins
10
- */
11
6
  showDetailslist: string[];
12
7
  functionAllowlist: string[];
13
8
  functionBlocklist: string[];
package/dist/esm/index.js CHANGED
@@ -14467,26 +14467,22 @@ const IS_BROWSER = typeof window !== "undefined" &&
14467
14467
  const IS_NODE = typeof process !== "undefined" &&
14468
14468
  process.release?.name === "node";
14469
14469
 
14470
- const LOG_CONFIG = {
14471
- condensed: process.env.LOG_CONDENSED !== "false",
14472
- expandOnDebug: process.env.LOG_EXPAND_DEBUG !== "false",
14473
- showDetails: process.env.LOG_SHOW_DETAILS !== "false",
14474
- maxDetailsLength: Number(process.env.LOG_DETAILS_MAX ?? 500),
14475
- /**
14476
- * Function-level filtering
14477
- * - empty allowlist = allow all
14478
- * - blocklist always wins
14479
- */
14480
- showDetailslist: process.env.LOG_DETAILS_ALLOWLIST
14481
- ? process.env.LOG_DETAILS_ALLOWLIST.split(",").map(s => s.trim())
14482
- : [],
14483
- functionAllowlist: process.env.LOG_FUNCTION_ALLOWLIST
14484
- ? process.env.LOG_FUNCTION_ALLOWLIST.split(",").map(s => s.trim())
14485
- : [],
14486
- functionBlocklist: process.env.LOG_FUNCTION_BLOCKLIST
14487
- ? process.env.LOG_FUNCTION_BLOCKLIST.split(",").map(s => s.trim())
14488
- : [],
14489
- };
14470
+ function parseList(value) {
14471
+ return value
14472
+ ? value.split(",").map(s => s.trim()).filter(Boolean)
14473
+ : [];
14474
+ }
14475
+ function getLogConfig() {
14476
+ return {
14477
+ condensed: process.env.LOG_CONDENSED !== "false",
14478
+ expandOnDebug: process.env.LOG_EXPAND_DEBUG !== "false",
14479
+ showDetails: process.env.LOG_SHOW_DETAILS !== "false",
14480
+ maxDetailsLength: Number(process.env.LOG_DETAILS_MAX ?? 500),
14481
+ showDetailslist: parseList(process.env.LOG_DETAILS_ALLOWLIST),
14482
+ functionAllowlist: parseList(process.env.LOG_FUNCTION_ALLOWLIST),
14483
+ functionBlocklist: parseList(process.env.LOG_FUNCTION_BLOCKLIST),
14484
+ };
14485
+ }
14490
14486
 
14491
14487
  /* ------------------------------------------------------------------ */
14492
14488
  /* Winston logger (Node only) */
@@ -14506,12 +14502,14 @@ if (IS_NODE) {
14506
14502
  });
14507
14503
  }
14508
14504
  function shouldCondense(logType) {
14505
+ const LOG_CONFIG = getLogConfig();
14509
14506
  if (LOG_CONFIG.expandOnDebug && logType === "debug") {
14510
14507
  return false;
14511
14508
  }
14512
14509
  return LOG_CONFIG.condensed;
14513
14510
  }
14514
14511
  function shouldShowDetails(logType) {
14512
+ const LOG_CONFIG = getLogConfig();
14515
14513
  const allow = LOG_CONFIG.showDetailslist;
14516
14514
  // If allowlist exists, it RESTRICTS
14517
14515
  if (allow.length > 0) {
@@ -14685,6 +14683,7 @@ function getLogString(messageOrOptions, logType = null, details = null, function
14685
14683
  let line = `${emoji} [${timestamp}] [${resolvedFunctionName}] ${message}`;
14686
14684
  // ---------------- Details serialization ----------------
14687
14685
  if (showDetails && resolvedDetails !== null && resolvedDetails !== undefined) {
14686
+ const LOG_CONFIG = getLogConfig();
14688
14687
  const serialized = serializeDetails(resolvedDetails, condense, LOG_CONFIG.maxDetailsLength);
14689
14688
  line += ` | ${serialized}`;
14690
14689
  }
@@ -14727,5 +14726,5 @@ function getLogString(messageOrOptions, logType = null, details = null, function
14727
14726
  return line;
14728
14727
  }
14729
14728
 
14730
- export { IS_BROWSER, IS_NODE, LOG_CONFIG, getLogString, logger, resolveValue, serializeDetails };
14729
+ export { IS_BROWSER, IS_NODE, getLogConfig, getLogString, logger, resolveValue, serializeDetails };
14731
14730
  //# sourceMappingURL=index.js.map