mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 02:10:15 +01:00
📜 feat: Configure JSON Log Truncation Size (#5215)
This commit is contained in:
parent
ae7814a2b3
commit
33e60c379b
1 changed files with 2 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ const traverse = require('traverse');
|
||||||
|
|
||||||
const SPLAT_SYMBOL = Symbol.for('splat');
|
const SPLAT_SYMBOL = Symbol.for('splat');
|
||||||
const MESSAGE_SYMBOL = Symbol.for('message');
|
const MESSAGE_SYMBOL = Symbol.for('message');
|
||||||
|
const CONSOLE_JSON_LONG_STRING_LENGTH=parseInt(process.env.CONSOLE_JSON_LONG_STRING_LENGTH) || 255;
|
||||||
|
|
||||||
const sensitiveKeys = [
|
const sensitiveKeys = [
|
||||||
/^(sk-)[^\s]+/, // OpenAI API key pattern
|
/^(sk-)[^\s]+/, // OpenAI API key pattern
|
||||||
|
|
@ -211,7 +212,7 @@ const jsonTruncateFormat = winston.format((info) => {
|
||||||
const newObj = {};
|
const newObj = {};
|
||||||
Object.entries(obj).forEach(([key, value]) => {
|
Object.entries(obj).forEach(([key, value]) => {
|
||||||
if (typeof value === 'string') {
|
if (typeof value === 'string') {
|
||||||
newObj[key] = truncateLongStrings(value, 255);
|
newObj[key] = truncateLongStrings(value, CONSOLE_JSON_LONG_STRING_LENGTH);
|
||||||
} else {
|
} else {
|
||||||
newObj[key] = truncateObject(value);
|
newObj[key] = truncateObject(value);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue