@putkoff/abstract-logger 0.0.50 → 0.0.57
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 +19 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/config.d.ts +4 -0
- package/dist/esm/index.js +19 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/config.d.ts +4 -0
- package/dist/index.d.ts +83 -0
- package/dist/types/config.d.ts +4 -0
- package/dist/types/index.d.ts +3 -79
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -297,6 +297,10 @@ function getLogConfig() {
|
|
|
297
297
|
condensed: getEnvValue({ key: "LOG_CONDENSED" }) !== "false",
|
|
298
298
|
expandOnDebug: getEnvValue({ key: "LOG_EXPAND_DEBUG" }) !== "false",
|
|
299
299
|
showDetails: getEnvValue({ key: "LOG_SHOW_DETAILS" }) !== "false",
|
|
300
|
+
showOnly: getEnvValue({ key: "LOG_SHOW_ONLY" }) === "true",
|
|
301
|
+
showOnlyFunctions: parseList("LOG_SHOW_ONLY_FUNCTIONS"),
|
|
302
|
+
showOnlyActivities: parseList("LOG_SHOW_ONLY_ACTIVITIES"),
|
|
303
|
+
showOnlyTypes: parseList("LOG_SHOW_ONLY_TYPES"),
|
|
300
304
|
maxDetailsLength: Number(getEnvValue({ key: "LOG_DETAILS_MAX" }) ?? 500),
|
|
301
305
|
sampleRate: Number(getEnvValue({ key: "LOG_SAMPLE_RATE" }) ?? 1),
|
|
302
306
|
prettyDetails: getEnvValue({ key: "LOG_PRETTY_DETAILS" }) === "true",
|
|
@@ -14871,12 +14875,26 @@ function hash(str) {
|
|
|
14871
14875
|
}
|
|
14872
14876
|
function shouldLog(opts, caller) {
|
|
14873
14877
|
const cfg = getLogConfig();
|
|
14874
|
-
// logType is already normalized upstream
|
|
14875
14878
|
const type = opts.logType;
|
|
14876
14879
|
const fn = caller.functionName;
|
|
14877
14880
|
const activity = opts.activity;
|
|
14878
14881
|
const message = opts.message;
|
|
14879
14882
|
// ─────────────────────────────────────
|
|
14883
|
+
// 🟥 0️⃣ SHOW-ONLY OVERRIDE (ABSOLUTE)
|
|
14884
|
+
// ─────────────────────────────────────
|
|
14885
|
+
if (cfg.showOnly) {
|
|
14886
|
+
if (cfg.showOnlyFunctions.length &&
|
|
14887
|
+
!cfg.showOnlyFunctions.includes(fn))
|
|
14888
|
+
return false;
|
|
14889
|
+
if (cfg.showOnlyActivities.length &&
|
|
14890
|
+
(!activity || !cfg.showOnlyActivities.includes(activity)))
|
|
14891
|
+
return false;
|
|
14892
|
+
if (cfg.showOnlyTypes.length &&
|
|
14893
|
+
!cfg.showOnlyTypes.includes(type))
|
|
14894
|
+
return false;
|
|
14895
|
+
return true; // 👈 NOTHING ELSE APPLIES
|
|
14896
|
+
}
|
|
14897
|
+
// ─────────────────────────────────────
|
|
14880
14898
|
// 1️⃣ Hard allowlist
|
|
14881
14899
|
// ─────────────────────────────────────
|
|
14882
14900
|
if (cfg.functionAllowlist.length > 0) {
|