@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.
@@ -1,3 +1,4 @@
1
+ import "dotenv/config";
1
2
  export type LogType = "success" | "processing" | "listening" | "computing" | "waiting" | "emitting" | "ingesting" | "prune" | "connect" | "info" | "warn" | "error" | "debug" | null;
2
3
  /** Exported logger */
3
4
  export declare const logger: any;
package/dist/esm/index.js CHANGED
@@ -10,6 +10,7 @@ import require$$1 from 'tty';
10
10
  import require$$1$1 from 'string_decoder';
11
11
  import require$$0$7 from 'http';
12
12
  import require$$1$3 from 'https';
13
+ import 'dotenv/config';
13
14
 
14
15
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
15
16
 
@@ -14467,26 +14468,28 @@ const IS_BROWSER = typeof window !== "undefined" &&
14467
14468
  const IS_NODE = typeof process !== "undefined" &&
14468
14469
  process.release?.name === "node";
14469
14470
 
14470
- function parseList(value) {
14471
- return value
14472
- ? value.split(",").map(s => s.trim()).filter(Boolean)
14473
- : [];
14474
- }
14475
14471
  function getLogConfig() {
14476
14472
  return {
14477
14473
  condensed: process.env.LOG_CONDENSED !== "false",
14478
14474
  expandOnDebug: process.env.LOG_EXPAND_DEBUG !== "false",
14479
14475
  showDetails: process.env.LOG_SHOW_DETAILS !== "false",
14480
14476
  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),
14477
+ showDetailslist: process.env.LOG_DETAILS_ALLOWLIST
14478
+ ? process.env.LOG_DETAILS_ALLOWLIST.split(",").map(s => s.trim())
14479
+ : [],
14480
+ functionAllowlist: process.env.LOG_FUNCTION_ALLOWLIST
14481
+ ? process.env.LOG_FUNCTION_ALLOWLIST.split(",").map(s => s.trim())
14482
+ : [],
14483
+ functionBlocklist: process.env.LOG_FUNCTION_BLOCKLIST
14484
+ ? process.env.LOG_FUNCTION_BLOCKLIST.split(",").map(s => s.trim())
14485
+ : [],
14484
14486
  };
14485
14487
  }
14486
14488
 
14487
- /* ------------------------------------------------------------------ */
14488
- /* Winston logger (Node only) */
14489
- /* ------------------------------------------------------------------ */
14489
+ console.log("ENV CHECK:", {
14490
+ LOG_SHOW_DETAILS: process.env.LOG_SHOW_DETAILS,
14491
+ LOG_DETAILS_ALLOWLIST: process.env.LOG_DETAILS_ALLOWLIST,
14492
+ });
14490
14493
  let nodeLogger = null;
14491
14494
  if (IS_NODE) {
14492
14495
  nodeLogger = winston.createLogger({
@@ -14509,14 +14512,11 @@ function shouldCondense(logType) {
14509
14512
  return LOG_CONFIG.condensed;
14510
14513
  }
14511
14514
  function shouldShowDetails(logType) {
14512
- const LOG_CONFIG = getLogConfig();
14513
- const allow = LOG_CONFIG.showDetailslist;
14514
- // If allowlist exists, it RESTRICTS
14515
- if (allow.length > 0) {
14516
- return allow.includes(logType);
14515
+ const cfg = getLogConfig();
14516
+ if (cfg.showDetailslist.length > 0) {
14517
+ return cfg.showDetailslist.includes(logType);
14517
14518
  }
14518
- // Otherwise fall back to global flag
14519
- return LOG_CONFIG.showDetails;
14519
+ return cfg.showDetails;
14520
14520
  }
14521
14521
  /** Exported logger */
14522
14522
  const logger = nodeLogger;