@putkoff/abstract-logger 0.0.26 → 0.0.29
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 +25 -24
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/config.d.ts +1 -6
- package/dist/cjs/types/logger/logger.d.ts +1 -0
- package/dist/esm/index.js +25 -24
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/config.d.ts +1 -6
- package/dist/esm/types/logger/logger.d.ts +1 -0
- package/dist/types/config.d.ts +1 -6
- package/dist/types/index.d.ts +2 -7
- package/dist/types/logger/logger.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare function getLogConfig(): {
|
|
2
2
|
condensed: boolean;
|
|
3
3
|
expandOnDebug: boolean;
|
|
4
4
|
showDetails: boolean;
|
|
5
5
|
maxDetailsLength: number;
|
|
6
|
-
/**
|
|
7
|
-
* Function-level filtering
|
|
8
|
-
* - empty allowlist = allow all
|
|
9
|
-
* - blocklist always wins
|
|
10
|
-
*/
|
|
11
6
|
showDetailslist: string[];
|
|
12
7
|
functionAllowlist: string[];
|
|
13
8
|
functionBlocklist: string[];
|
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,30 +14468,27 @@ const IS_BROWSER = typeof window !== "undefined" &&
|
|
|
14467
14468
|
const IS_NODE = typeof process !== "undefined" &&
|
|
14468
14469
|
process.release?.name === "node";
|
|
14469
14470
|
|
|
14470
|
-
|
|
14471
|
-
|
|
14472
|
-
|
|
14473
|
-
|
|
14474
|
-
|
|
14475
|
-
|
|
14476
|
-
|
|
14477
|
-
|
|
14478
|
-
|
|
14479
|
-
|
|
14480
|
-
|
|
14481
|
-
|
|
14482
|
-
:
|
|
14483
|
-
|
|
14484
|
-
|
|
14485
|
-
|
|
14486
|
-
functionBlocklist: process.env.LOG_FUNCTION_BLOCKLIST
|
|
14487
|
-
? process.env.LOG_FUNCTION_BLOCKLIST.split(",").map(s => s.trim())
|
|
14488
|
-
: [],
|
|
14489
|
-
};
|
|
14471
|
+
function parseList(value) {
|
|
14472
|
+
return value
|
|
14473
|
+
? value.split(",").map(s => s.trim()).filter(Boolean)
|
|
14474
|
+
: [];
|
|
14475
|
+
}
|
|
14476
|
+
function getLogConfig() {
|
|
14477
|
+
return {
|
|
14478
|
+
condensed: process.env.LOG_CONDENSED !== "false",
|
|
14479
|
+
expandOnDebug: process.env.LOG_EXPAND_DEBUG !== "false",
|
|
14480
|
+
showDetails: process.env.LOG_SHOW_DETAILS !== "false",
|
|
14481
|
+
maxDetailsLength: Number(process.env.LOG_DETAILS_MAX ?? 500),
|
|
14482
|
+
showDetailslist: parseList(process.env.LOG_DETAILS_ALLOWLIST),
|
|
14483
|
+
functionAllowlist: parseList(process.env.LOG_FUNCTION_ALLOWLIST),
|
|
14484
|
+
functionBlocklist: parseList(process.env.LOG_FUNCTION_BLOCKLIST),
|
|
14485
|
+
};
|
|
14486
|
+
}
|
|
14490
14487
|
|
|
14491
|
-
|
|
14492
|
-
|
|
14493
|
-
|
|
14488
|
+
console.log("ENV CHECK:", {
|
|
14489
|
+
LOG_SHOW_DETAILS: process.env.LOG_SHOW_DETAILS,
|
|
14490
|
+
LOG_DETAILS_ALLOWLIST: process.env.LOG_DETAILS_ALLOWLIST,
|
|
14491
|
+
});
|
|
14494
14492
|
let nodeLogger = null;
|
|
14495
14493
|
if (IS_NODE) {
|
|
14496
14494
|
nodeLogger = winston.createLogger({
|
|
@@ -14506,12 +14504,14 @@ if (IS_NODE) {
|
|
|
14506
14504
|
});
|
|
14507
14505
|
}
|
|
14508
14506
|
function shouldCondense(logType) {
|
|
14507
|
+
const LOG_CONFIG = getLogConfig();
|
|
14509
14508
|
if (LOG_CONFIG.expandOnDebug && logType === "debug") {
|
|
14510
14509
|
return false;
|
|
14511
14510
|
}
|
|
14512
14511
|
return LOG_CONFIG.condensed;
|
|
14513
14512
|
}
|
|
14514
14513
|
function shouldShowDetails(logType) {
|
|
14514
|
+
const LOG_CONFIG = getLogConfig();
|
|
14515
14515
|
const allow = LOG_CONFIG.showDetailslist;
|
|
14516
14516
|
// If allowlist exists, it RESTRICTS
|
|
14517
14517
|
if (allow.length > 0) {
|
|
@@ -14685,6 +14685,7 @@ function getLogString(messageOrOptions, logType = null, details = null, function
|
|
|
14685
14685
|
let line = `${emoji} [${timestamp}] [${resolvedFunctionName}] ${message}`;
|
|
14686
14686
|
// ---------------- Details serialization ----------------
|
|
14687
14687
|
if (showDetails && resolvedDetails !== null && resolvedDetails !== undefined) {
|
|
14688
|
+
const LOG_CONFIG = getLogConfig();
|
|
14688
14689
|
const serialized = serializeDetails(resolvedDetails, condense, LOG_CONFIG.maxDetailsLength);
|
|
14689
14690
|
line += ` | ${serialized}`;
|
|
14690
14691
|
}
|
|
@@ -14727,5 +14728,5 @@ function getLogString(messageOrOptions, logType = null, details = null, function
|
|
|
14727
14728
|
return line;
|
|
14728
14729
|
}
|
|
14729
14730
|
|
|
14730
|
-
export { IS_BROWSER, IS_NODE,
|
|
14731
|
+
export { IS_BROWSER, IS_NODE, getLogConfig, getLogString, logger, resolveValue, serializeDetails };
|
|
14731
14732
|
//# sourceMappingURL=index.js.map
|