@putkoff/abstract-logger 0.0.49 → 0.0.51
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 +27 -24
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/config.d.ts +6 -5
- package/dist/esm/index.js +27 -24
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/config.d.ts +6 -5
- package/dist/types/config.d.ts +6 -5
- package/dist/types/index.d.ts +6 -5
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -42,7 +42,7 @@ function resolveValue(...values) {
|
|
|
42
42
|
}
|
|
43
43
|
return sawInput ? "unknown" : "unknown";
|
|
44
44
|
}
|
|
45
|
-
function parseList(value) {
|
|
45
|
+
function parseList$1(value) {
|
|
46
46
|
return value
|
|
47
47
|
? value.split(",").map(s => s.trim()).filter(Boolean)
|
|
48
48
|
: [];
|
|
@@ -288,45 +288,48 @@ function getEnvValue(options = {}) {
|
|
|
288
288
|
return env.envValue;
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
291
|
+
function parseList(key) {
|
|
292
|
+
const v = getEnvValue({ key });
|
|
293
|
+
return v ? v.split(",").map(s => s.trim()).filter(Boolean) : [];
|
|
294
|
+
}
|
|
295
|
+
let cachedConfig = null;
|
|
296
|
+
function buildLogConfig() {
|
|
295
297
|
return {
|
|
296
298
|
condensed: getEnvValue({ key: "LOG_CONDENSED" }) !== "false",
|
|
297
299
|
expandOnDebug: getEnvValue({ key: "LOG_EXPAND_DEBUG" }) !== "false",
|
|
298
300
|
showDetails: getEnvValue({ key: "LOG_SHOW_DETAILS" }) !== "false",
|
|
301
|
+
envlockdown: getEnvValue({ key: "LOCKDOWN" }) !== "false",
|
|
299
302
|
maxDetailsLength: Number(getEnvValue({ key: "LOG_DETAILS_MAX" }) ?? 500),
|
|
300
|
-
|
|
301
|
-
logTypeBlocklist: parse$1(getEnvValue({ key: "LOG_TYPE_BLOCKLIST" }) || ""),
|
|
302
|
-
sampleRate: Number(getEnvValue({ key: "LOG_SAMPLE_RATE" }) ?? 1), // 0–1
|
|
303
|
-
// 👇 NEW
|
|
303
|
+
sampleRate: Number(getEnvValue({ key: "LOG_SAMPLE_RATE" }) ?? 1),
|
|
304
304
|
prettyDetails: getEnvValue({ key: "LOG_PRETTY_DETAILS" }) === "true",
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
functionAllowlist:
|
|
309
|
-
|
|
310
|
-
: [],
|
|
311
|
-
functionBlocklist: getEnvValue({ key: "LOG_FUNCTION_BLOCKLIST" })
|
|
312
|
-
? getEnvValue({ key: "LOG_FUNCTION_BLOCKLIST" }) || "".split(",").map(s => s.trim())
|
|
313
|
-
: [],
|
|
305
|
+
activityBlocklist: parseList("LOG_ACTIVITY_BLOCKLIST"),
|
|
306
|
+
logTypeBlocklist: parseList("LOG_TYPE_BLOCKLIST"),
|
|
307
|
+
showDetailslist: parseList("LOG_DETAILS_ALLOWLIST"),
|
|
308
|
+
functionAllowlist: parseList("LOG_FUNCTION_ALLOWLIST"),
|
|
309
|
+
functionBlocklist: parseList("LOG_FUNCTION_BLOCKLIST"),
|
|
314
310
|
};
|
|
315
311
|
}
|
|
312
|
+
function getLogConfig() {
|
|
313
|
+
if (!cachedConfig) {
|
|
314
|
+
const params = buildLogConfig();
|
|
315
|
+
if (!params.envlockdown) {
|
|
316
|
+
cachedConfig = params;
|
|
317
|
+
}
|
|
318
|
+
return params;
|
|
319
|
+
}
|
|
320
|
+
return cachedConfig;
|
|
321
|
+
}
|
|
316
322
|
function debugLogConfig() {
|
|
317
323
|
if (getEnvValue({ key: "LOG_DEBUG_CONFIG" }) === "true") {
|
|
318
|
-
console.log("LOG CONFIG ENV:"
|
|
324
|
+
console.log("LOG CONFIG ENV:", {
|
|
319
325
|
LOG_SHOW_DETAILS: getEnvValue({ key: "LOG_SHOW_DETAILS" }),
|
|
320
326
|
LOG_DETAILS_ALLOWLIST: getEnvValue({ key: "LOG_DETAILS_ALLOWLIST" }),
|
|
321
327
|
LOG_PRETTY_DETAILS: getEnvValue({ key: "LOG_PRETTY_DETAILS" }),
|
|
322
328
|
LOG_CONDENSED: getEnvValue({ key: "LOG_CONDENSED" }),
|
|
323
329
|
LOG_EXPAND_DEBUG: getEnvValue({ key: "LOG_EXPAND_DEBUG" }),
|
|
324
|
-
};
|
|
330
|
+
});
|
|
325
331
|
}
|
|
326
332
|
}
|
|
327
|
-
function parse$1(v) {
|
|
328
|
-
return v ? v.split(",").map(s => s.trim()) : [];
|
|
329
|
-
}
|
|
330
333
|
|
|
331
334
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
332
335
|
|
|
@@ -15005,7 +15008,7 @@ exports.getNodeLogger = getNodeLogger;
|
|
|
15005
15008
|
exports.logger = logger;
|
|
15006
15009
|
exports.padLeft = padLeft;
|
|
15007
15010
|
exports.padRight = padRight;
|
|
15008
|
-
exports.parseList = parseList;
|
|
15011
|
+
exports.parseList = parseList$1;
|
|
15009
15012
|
exports.resolveLogger = resolveLogger;
|
|
15010
15013
|
exports.resolveValue = resolveValue;
|
|
15011
15014
|
exports.serializeDetails = serializeDetails;
|