@putkoff/abstract-logger 0.0.23 โ 0.0.26
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 +18 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/config.d.ts +2 -0
- package/dist/cjs/types/logger/logger.d.ts +1 -1
- package/dist/esm/index.js +18 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/config.d.ts +2 -0
- package/dist/esm/types/logger/logger.d.ts +1 -1
- package/dist/types/config.d.ts +2 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/logger/logger.d.ts +1 -1
- package/package.json +6 -5
package/dist/cjs/index.js
CHANGED
|
@@ -14472,12 +14472,16 @@ const IS_NODE = typeof process !== "undefined" &&
|
|
|
14472
14472
|
const LOG_CONFIG = {
|
|
14473
14473
|
condensed: process.env.LOG_CONDENSED !== "false",
|
|
14474
14474
|
expandOnDebug: process.env.LOG_EXPAND_DEBUG !== "false",
|
|
14475
|
+
showDetails: process.env.LOG_SHOW_DETAILS !== "false",
|
|
14475
14476
|
maxDetailsLength: Number(process.env.LOG_DETAILS_MAX ?? 500),
|
|
14476
14477
|
/**
|
|
14477
14478
|
* Function-level filtering
|
|
14478
14479
|
* - empty allowlist = allow all
|
|
14479
14480
|
* - blocklist always wins
|
|
14480
14481
|
*/
|
|
14482
|
+
showDetailslist: process.env.LOG_DETAILS_ALLOWLIST
|
|
14483
|
+
? process.env.LOG_DETAILS_ALLOWLIST.split(",").map(s => s.trim())
|
|
14484
|
+
: [],
|
|
14481
14485
|
functionAllowlist: process.env.LOG_FUNCTION_ALLOWLIST
|
|
14482
14486
|
? process.env.LOG_FUNCTION_ALLOWLIST.split(",").map(s => s.trim())
|
|
14483
14487
|
: [],
|
|
@@ -14509,6 +14513,15 @@ function shouldCondense(logType) {
|
|
|
14509
14513
|
}
|
|
14510
14514
|
return LOG_CONFIG.condensed;
|
|
14511
14515
|
}
|
|
14516
|
+
function shouldShowDetails(logType) {
|
|
14517
|
+
const allow = LOG_CONFIG.showDetailslist;
|
|
14518
|
+
// If allowlist exists, it RESTRICTS
|
|
14519
|
+
if (allow.length > 0) {
|
|
14520
|
+
return allow.includes(logType);
|
|
14521
|
+
}
|
|
14522
|
+
// Otherwise fall back to global flag
|
|
14523
|
+
return LOG_CONFIG.showDetails;
|
|
14524
|
+
}
|
|
14512
14525
|
/** Exported logger */
|
|
14513
14526
|
const logger = nodeLogger;
|
|
14514
14527
|
/**
|
|
@@ -14651,10 +14664,13 @@ function getLogString(messageOrOptions, logType = null, details = null, function
|
|
|
14651
14664
|
const emojiMap = {
|
|
14652
14665
|
success: "โ
",
|
|
14653
14666
|
processing: "๐",
|
|
14667
|
+
listening: "๐ก",
|
|
14654
14668
|
computing: "๐ง ",
|
|
14655
14669
|
waiting: "โณ",
|
|
14656
14670
|
emitting: "๐ค",
|
|
14657
14671
|
ingesting: "๐ฅ",
|
|
14672
|
+
prune: "๐งน",
|
|
14673
|
+
connect: "๐",
|
|
14658
14674
|
info: "โน๏ธ",
|
|
14659
14675
|
warn: "โ ๏ธ",
|
|
14660
14676
|
error: "โ",
|
|
@@ -14664,12 +14680,13 @@ function getLogString(messageOrOptions, logType = null, details = null, function
|
|
|
14664
14680
|
const emoji = emojiMap[finalLogType] ?? "โน๏ธ";
|
|
14665
14681
|
const timestamp = new Date().toISOString();
|
|
14666
14682
|
const condense = shouldCondense(finalLogType);
|
|
14683
|
+
const showDetails = shouldShowDetails(finalLogType);
|
|
14667
14684
|
if (condense) {
|
|
14668
14685
|
resolvedFileLocation = resolvedFileLocation.split("/").pop();
|
|
14669
14686
|
}
|
|
14670
14687
|
let line = `${emoji} [${timestamp}] [${resolvedFunctionName}] ${message}`;
|
|
14671
14688
|
// ---------------- Details serialization ----------------
|
|
14672
|
-
if (resolvedDetails !== null && resolvedDetails !== undefined) {
|
|
14689
|
+
if (showDetails && resolvedDetails !== null && resolvedDetails !== undefined) {
|
|
14673
14690
|
const serialized = serializeDetails(resolvedDetails, condense, LOG_CONFIG.maxDetailsLength);
|
|
14674
14691
|
line += ` | ${serialized}`;
|
|
14675
14692
|
}
|