@putkoff/abstract-logger 0.0.75 → 0.0.76

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.
@@ -3,6 +3,7 @@ export declare function getLogConfig(): {
3
3
  expandOnDebug: boolean;
4
4
  showDetails: boolean;
5
5
  showOnly: boolean;
6
+ functionAllowlistStrict: boolean;
6
7
  showOnlyFunctions: string[];
7
8
  showOnlyActivities: string[];
8
9
  showOnlyTypes: string[];
package/dist/esm/index.js CHANGED
@@ -125,6 +125,7 @@ function getLogConfig() {
125
125
  expandOnDebug: getEnvValue({ key: "LOG_EXPAND_DEBUG" }) !== "false",
126
126
  showDetails: getEnvValue({ key: "LOG_SHOW_DETAILS" }) !== "false",
127
127
  showOnly: getEnvValue({ key: "LOG_SHOW_ONLY" }) === "true",
128
+ functionAllowlistStrict: getEnvValue({ key: "LOG_FUNCTION_ALLOWLIST_STRICT" }) === "true",
128
129
  showOnlyFunctions: parseList$1("LOG_SHOW_ONLY_FUNCTIONS"),
129
130
  showOnlyActivities: parseList$1("LOG_SHOW_ONLY_ACTIVITIES"),
130
131
  showOnlyTypes: parseList$1("LOG_SHOW_ONLY_TYPES"),
@@ -14966,17 +14967,10 @@ function shouldLog(opts, caller) {
14966
14967
  if (cfg.showOnlyTypes.length &&
14967
14968
  !cfg.showOnlyTypes.includes(type))
14968
14969
  return false;
14969
- return true; // 👈 NOTHING ELSE APPLIES
14970
- }
14971
- // ─────────────────────────────────────
14972
- // 1️⃣ Hard allowlist
14973
- // ─────────────────────────────────────
14974
- if (cfg.functionAllowlist.length > 0) {
14975
- if (!cfg.functionAllowlist.includes(fn))
14976
- return false;
14970
+ return true;
14977
14971
  }
14978
14972
  // ─────────────────────────────────────
14979
- // 2️⃣ Hard blocklists
14973
+ // 1️⃣ Hard blocklists (ALWAYS APPLY)
14980
14974
  // ─────────────────────────────────────
14981
14975
  if (cfg.functionBlocklist.includes(fn))
14982
14976
  return false;
@@ -14985,7 +14979,16 @@ function shouldLog(opts, caller) {
14985
14979
  if (cfg.logTypeBlocklist.includes(type))
14986
14980
  return false;
14987
14981
  // ─────────────────────────────────────
14988
- // 3️⃣ Burst protection (debug)
14982
+ // 2️⃣ Function allowlist (optional narrowing)
14983
+ // ─────────────────────────────────────
14984
+ if (cfg.functionAllowlist.length > 0) {
14985
+ const allowed = cfg.functionAllowlist.includes(fn);
14986
+ if (!allowed && cfg.functionAllowlistStrict) {
14987
+ return false;
14988
+ }
14989
+ }
14990
+ // ─────────────────────────────────────
14991
+ // 3️⃣ Burst protection (debug only)
14989
14992
  // ─────────────────────────────────────
14990
14993
  if (type === "debug") {
14991
14994
  const key = fn + ":" + message;