@putkoff/abstract-logger 0.0.28 → 0.0.30

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
@@ -12,6 +12,7 @@ var require$$1 = require('tty');
12
12
  var require$$1$1 = require('string_decoder');
13
13
  var require$$0$7 = require('http');
14
14
  var require$$1$3 = require('https');
15
+ require('dotenv/config');
15
16
 
16
17
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
17
18
 
@@ -14469,26 +14470,28 @@ const IS_BROWSER = typeof window !== "undefined" &&
14469
14470
  const IS_NODE = typeof process !== "undefined" &&
14470
14471
  process.release?.name === "node";
14471
14472
 
14472
- function parseList(value) {
14473
- return value
14474
- ? value.split(",").map(s => s.trim()).filter(Boolean)
14475
- : [];
14476
- }
14477
14473
  function getLogConfig() {
14478
14474
  return {
14479
14475
  condensed: process.env.LOG_CONDENSED !== "false",
14480
14476
  expandOnDebug: process.env.LOG_EXPAND_DEBUG !== "false",
14481
14477
  showDetails: process.env.LOG_SHOW_DETAILS !== "false",
14482
14478
  maxDetailsLength: Number(process.env.LOG_DETAILS_MAX ?? 500),
14483
- showDetailslist: parseList(process.env.LOG_DETAILS_ALLOWLIST),
14484
- functionAllowlist: parseList(process.env.LOG_FUNCTION_ALLOWLIST),
14485
- functionBlocklist: parseList(process.env.LOG_FUNCTION_BLOCKLIST),
14479
+ showDetailslist: process.env.LOG_DETAILS_ALLOWLIST
14480
+ ? process.env.LOG_DETAILS_ALLOWLIST.split(",").map(s => s.trim())
14481
+ : [],
14482
+ functionAllowlist: process.env.LOG_FUNCTION_ALLOWLIST
14483
+ ? process.env.LOG_FUNCTION_ALLOWLIST.split(",").map(s => s.trim())
14484
+ : [],
14485
+ functionBlocklist: process.env.LOG_FUNCTION_BLOCKLIST
14486
+ ? process.env.LOG_FUNCTION_BLOCKLIST.split(",").map(s => s.trim())
14487
+ : [],
14486
14488
  };
14487
14489
  }
14488
14490
 
14489
- /* ------------------------------------------------------------------ */
14490
- /* Winston logger (Node only) */
14491
- /* ------------------------------------------------------------------ */
14491
+ console.log("ENV CHECK:", {
14492
+ LOG_SHOW_DETAILS: process.env.LOG_SHOW_DETAILS,
14493
+ LOG_DETAILS_ALLOWLIST: process.env.LOG_DETAILS_ALLOWLIST,
14494
+ });
14492
14495
  let nodeLogger = null;
14493
14496
  if (IS_NODE) {
14494
14497
  nodeLogger = winston.createLogger({
@@ -14511,14 +14514,11 @@ function shouldCondense(logType) {
14511
14514
  return LOG_CONFIG.condensed;
14512
14515
  }
14513
14516
  function shouldShowDetails(logType) {
14514
- const LOG_CONFIG = getLogConfig();
14515
- const allow = LOG_CONFIG.showDetailslist;
14516
- // If allowlist exists, it RESTRICTS
14517
- if (allow.length > 0) {
14518
- return allow.includes(logType);
14517
+ const cfg = getLogConfig();
14518
+ if (cfg.showDetailslist.length > 0) {
14519
+ return cfg.showDetailslist.includes(logType);
14519
14520
  }
14520
- // Otherwise fall back to global flag
14521
- return LOG_CONFIG.showDetails;
14521
+ return cfg.showDetails;
14522
14522
  }
14523
14523
  /** Exported logger */
14524
14524
  const logger = nodeLogger;