@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.
- package/dist/cjs/index.js +20 -21
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/config.d.ts +1 -6
- package/dist/esm/index.js +20 -21
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/config.d.ts +1 -6
- package/dist/types/config.d.ts +1 -6
- package/dist/types/index.d.ts +2 -7
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -14469,26 +14469,22 @@ const IS_BROWSER = typeof window !== "undefined" &&
|
|
|
14469
14469
|
const IS_NODE = typeof process !== "undefined" &&
|
|
14470
14470
|
process.release?.name === "node";
|
|
14471
14471
|
|
|
14472
|
-
|
|
14473
|
-
|
|
14474
|
-
|
|
14475
|
-
|
|
14476
|
-
|
|
14477
|
-
|
|
14478
|
-
|
|
14479
|
-
|
|
14480
|
-
|
|
14481
|
-
|
|
14482
|
-
|
|
14483
|
-
|
|
14484
|
-
:
|
|
14485
|
-
|
|
14486
|
-
|
|
14487
|
-
|
|
14488
|
-
functionBlocklist: process.env.LOG_FUNCTION_BLOCKLIST
|
|
14489
|
-
? process.env.LOG_FUNCTION_BLOCKLIST.split(",").map(s => s.trim())
|
|
14490
|
-
: [],
|
|
14491
|
-
};
|
|
14472
|
+
function parseList(value) {
|
|
14473
|
+
return value
|
|
14474
|
+
? value.split(",").map(s => s.trim()).filter(Boolean)
|
|
14475
|
+
: [];
|
|
14476
|
+
}
|
|
14477
|
+
function getLogConfig() {
|
|
14478
|
+
return {
|
|
14479
|
+
condensed: process.env.LOG_CONDENSED !== "false",
|
|
14480
|
+
expandOnDebug: process.env.LOG_EXPAND_DEBUG !== "false",
|
|
14481
|
+
showDetails: process.env.LOG_SHOW_DETAILS !== "false",
|
|
14482
|
+
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),
|
|
14486
|
+
};
|
|
14487
|
+
}
|
|
14492
14488
|
|
|
14493
14489
|
/* ------------------------------------------------------------------ */
|
|
14494
14490
|
/* Winston logger (Node only) */
|
|
@@ -14508,12 +14504,14 @@ if (IS_NODE) {
|
|
|
14508
14504
|
});
|
|
14509
14505
|
}
|
|
14510
14506
|
function shouldCondense(logType) {
|
|
14507
|
+
const LOG_CONFIG = getLogConfig();
|
|
14511
14508
|
if (LOG_CONFIG.expandOnDebug && logType === "debug") {
|
|
14512
14509
|
return false;
|
|
14513
14510
|
}
|
|
14514
14511
|
return LOG_CONFIG.condensed;
|
|
14515
14512
|
}
|
|
14516
14513
|
function shouldShowDetails(logType) {
|
|
14514
|
+
const LOG_CONFIG = getLogConfig();
|
|
14517
14515
|
const allow = LOG_CONFIG.showDetailslist;
|
|
14518
14516
|
// If allowlist exists, it RESTRICTS
|
|
14519
14517
|
if (allow.length > 0) {
|
|
@@ -14687,6 +14685,7 @@ function getLogString(messageOrOptions, logType = null, details = null, function
|
|
|
14687
14685
|
let line = `${emoji} [${timestamp}] [${resolvedFunctionName}] ${message}`;
|
|
14688
14686
|
// ---------------- Details serialization ----------------
|
|
14689
14687
|
if (showDetails && resolvedDetails !== null && resolvedDetails !== undefined) {
|
|
14688
|
+
const LOG_CONFIG = getLogConfig();
|
|
14690
14689
|
const serialized = serializeDetails(resolvedDetails, condense, LOG_CONFIG.maxDetailsLength);
|
|
14691
14690
|
line += ` | ${serialized}`;
|
|
14692
14691
|
}
|
|
@@ -14731,7 +14730,7 @@ function getLogString(messageOrOptions, logType = null, details = null, function
|
|
|
14731
14730
|
|
|
14732
14731
|
exports.IS_BROWSER = IS_BROWSER;
|
|
14733
14732
|
exports.IS_NODE = IS_NODE;
|
|
14734
|
-
exports.
|
|
14733
|
+
exports.getLogConfig = getLogConfig;
|
|
14735
14734
|
exports.getLogString = getLogString;
|
|
14736
14735
|
exports.logger = logger;
|
|
14737
14736
|
exports.resolveValue = resolveValue;
|