keryx 0.12.2 → 0.12.3
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/classes/Connection.ts +11 -0
- package/config/logger.ts +2 -0
- package/package.json +1 -1
package/classes/Connection.ts
CHANGED
|
@@ -410,9 +410,20 @@ const sanitizeParams = (
|
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
412
|
|
|
413
|
+
const maxParamLength = config.logger.maxParamLength;
|
|
414
|
+
|
|
413
415
|
for (const [k, v] of Object.entries(params)) {
|
|
414
416
|
if (secretFields.has(k)) {
|
|
415
417
|
sanitizedParams[k] = REDACTED;
|
|
418
|
+
} else if (maxParamLength > 0) {
|
|
419
|
+
const stringified = typeof v === "string" ? v : JSON.stringify(v);
|
|
420
|
+
if (stringified && stringified.length > maxParamLength) {
|
|
421
|
+
sanitizedParams[k] =
|
|
422
|
+
stringified.slice(0, maxParamLength) +
|
|
423
|
+
`... (truncated, original length: ${stringified.length})`;
|
|
424
|
+
} else {
|
|
425
|
+
sanitizedParams[k] = v;
|
|
426
|
+
}
|
|
416
427
|
} else {
|
|
417
428
|
sanitizedParams[k] = v;
|
|
418
429
|
}
|
package/config/logger.ts
CHANGED
|
@@ -6,4 +6,6 @@ export const configLogger = {
|
|
|
6
6
|
includeTimestamps: await loadFromEnvIfSet("LOG_INCLUDE_TIMESTAMPS", true),
|
|
7
7
|
colorize: await loadFromEnvIfSet("LOG_COLORIZE", true),
|
|
8
8
|
format: await loadFromEnvIfSet<LogFormat>("LOG_FORMAT", LogFormat.text),
|
|
9
|
+
/** Maximum length of individual param values in action logs before truncation. Set to 0 to disable truncation. */
|
|
10
|
+
maxParamLength: await loadFromEnvIfSet("LOG_MAX_PARAM_LENGTH", 100),
|
|
9
11
|
};
|