@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
|
@@ -2,13 +2,14 @@ export declare function getLogConfig(): {
|
|
|
2
2
|
condensed: boolean;
|
|
3
3
|
expandOnDebug: boolean;
|
|
4
4
|
showDetails: boolean;
|
|
5
|
+
envlockdown: boolean;
|
|
5
6
|
maxDetailsLength: number;
|
|
6
|
-
activityBlocklist: string[];
|
|
7
|
-
logTypeBlocklist: string[];
|
|
8
7
|
sampleRate: number;
|
|
9
8
|
prettyDetails: boolean;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
activityBlocklist: string[];
|
|
10
|
+
logTypeBlocklist: string[];
|
|
11
|
+
showDetailslist: string[];
|
|
12
|
+
functionAllowlist: string[];
|
|
13
|
+
functionBlocklist: string[];
|
|
13
14
|
};
|
|
14
15
|
export declare function debugLogConfig(): void;
|
package/dist/esm/index.js
CHANGED
|
@@ -40,7 +40,7 @@ function resolveValue(...values) {
|
|
|
40
40
|
}
|
|
41
41
|
return sawInput ? "unknown" : "unknown";
|
|
42
42
|
}
|
|
43
|
-
function parseList(value) {
|
|
43
|
+
function parseList$1(value) {
|
|
44
44
|
return value
|
|
45
45
|
? value.split(",").map(s => s.trim()).filter(Boolean)
|
|
46
46
|
: [];
|
|
@@ -286,45 +286,48 @@ function getEnvValue(options = {}) {
|
|
|
286
286
|
return env.envValue;
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
289
|
+
function parseList(key) {
|
|
290
|
+
const v = getEnvValue({ key });
|
|
291
|
+
return v ? v.split(",").map(s => s.trim()).filter(Boolean) : [];
|
|
292
|
+
}
|
|
293
|
+
let cachedConfig = null;
|
|
294
|
+
function buildLogConfig() {
|
|
293
295
|
return {
|
|
294
296
|
condensed: getEnvValue({ key: "LOG_CONDENSED" }) !== "false",
|
|
295
297
|
expandOnDebug: getEnvValue({ key: "LOG_EXPAND_DEBUG" }) !== "false",
|
|
296
298
|
showDetails: getEnvValue({ key: "LOG_SHOW_DETAILS" }) !== "false",
|
|
299
|
+
envlockdown: getEnvValue({ key: "LOCKDOWN" }) !== "false",
|
|
297
300
|
maxDetailsLength: Number(getEnvValue({ key: "LOG_DETAILS_MAX" }) ?? 500),
|
|
298
|
-
|
|
299
|
-
logTypeBlocklist: parse$1(getEnvValue({ key: "LOG_TYPE_BLOCKLIST" }) || ""),
|
|
300
|
-
sampleRate: Number(getEnvValue({ key: "LOG_SAMPLE_RATE" }) ?? 1), // 0–1
|
|
301
|
-
// 👇 NEW
|
|
301
|
+
sampleRate: Number(getEnvValue({ key: "LOG_SAMPLE_RATE" }) ?? 1),
|
|
302
302
|
prettyDetails: getEnvValue({ key: "LOG_PRETTY_DETAILS" }) === "true",
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
functionAllowlist:
|
|
307
|
-
|
|
308
|
-
: [],
|
|
309
|
-
functionBlocklist: getEnvValue({ key: "LOG_FUNCTION_BLOCKLIST" })
|
|
310
|
-
? getEnvValue({ key: "LOG_FUNCTION_BLOCKLIST" }) || "".split(",").map(s => s.trim())
|
|
311
|
-
: [],
|
|
303
|
+
activityBlocklist: parseList("LOG_ACTIVITY_BLOCKLIST"),
|
|
304
|
+
logTypeBlocklist: parseList("LOG_TYPE_BLOCKLIST"),
|
|
305
|
+
showDetailslist: parseList("LOG_DETAILS_ALLOWLIST"),
|
|
306
|
+
functionAllowlist: parseList("LOG_FUNCTION_ALLOWLIST"),
|
|
307
|
+
functionBlocklist: parseList("LOG_FUNCTION_BLOCKLIST"),
|
|
312
308
|
};
|
|
313
309
|
}
|
|
310
|
+
function getLogConfig() {
|
|
311
|
+
if (!cachedConfig) {
|
|
312
|
+
const params = buildLogConfig();
|
|
313
|
+
if (!params.envlockdown) {
|
|
314
|
+
cachedConfig = params;
|
|
315
|
+
}
|
|
316
|
+
return params;
|
|
317
|
+
}
|
|
318
|
+
return cachedConfig;
|
|
319
|
+
}
|
|
314
320
|
function debugLogConfig() {
|
|
315
321
|
if (getEnvValue({ key: "LOG_DEBUG_CONFIG" }) === "true") {
|
|
316
|
-
console.log("LOG CONFIG ENV:"
|
|
322
|
+
console.log("LOG CONFIG ENV:", {
|
|
317
323
|
LOG_SHOW_DETAILS: getEnvValue({ key: "LOG_SHOW_DETAILS" }),
|
|
318
324
|
LOG_DETAILS_ALLOWLIST: getEnvValue({ key: "LOG_DETAILS_ALLOWLIST" }),
|
|
319
325
|
LOG_PRETTY_DETAILS: getEnvValue({ key: "LOG_PRETTY_DETAILS" }),
|
|
320
326
|
LOG_CONDENSED: getEnvValue({ key: "LOG_CONDENSED" }),
|
|
321
327
|
LOG_EXPAND_DEBUG: getEnvValue({ key: "LOG_EXPAND_DEBUG" }),
|
|
322
|
-
};
|
|
328
|
+
});
|
|
323
329
|
}
|
|
324
330
|
}
|
|
325
|
-
function parse$1(v) {
|
|
326
|
-
return v ? v.split(",").map(s => s.trim()) : [];
|
|
327
|
-
}
|
|
328
331
|
|
|
329
332
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
330
333
|
|
|
@@ -14988,5 +14991,5 @@ function getLogString(messageOrOptions, logType = null, details = null, function
|
|
|
14988
14991
|
}), finalLogType, resolvedLoggerInput);
|
|
14989
14992
|
}
|
|
14990
14993
|
|
|
14991
|
-
export { COLS, IS_BROWSER, IS_NODE, activityEmojiMap, debugLogConfig, extractFile, formatLogLine, getCallerInfo, getFinalLine, getLogConfig, getLogString, getNodeLogger, logger, padLeft, padRight, parseList, resolveLogger, resolveValue, serializeDetails, shouldCondense, shouldShowDetails };
|
|
14994
|
+
export { COLS, IS_BROWSER, IS_NODE, activityEmojiMap, debugLogConfig, extractFile, formatLogLine, getCallerInfo, getFinalLine, getLogConfig, getLogString, getNodeLogger, logger, padLeft, padRight, parseList$1 as parseList, resolveLogger, resolveValue, serializeDetails, shouldCondense, shouldShowDetails };
|
|
14992
14995
|
//# sourceMappingURL=index.js.map
|