mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 06:00:56 +02: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 MESSAGE_SYMBOL = Symbol.for('message');
|
||||
const CONSOLE_JSON_LONG_STRING_LENGTH=parseInt(process.env.CONSOLE_JSON_LONG_STRING_LENGTH) || 255;
|
||||
|
||||
const sensitiveKeys = [
|
||||
/^(sk-)[^\s]+/, // OpenAI API key pattern
|
||||
|
@ -211,7 +212,7 @@ const jsonTruncateFormat = winston.format((info) => {
|
|||
const newObj = {};
|
||||
Object.entries(obj).forEach(([key, value]) => {
|
||||
if (typeof value === 'string') {
|
||||
newObj[key] = truncateLongStrings(value, 255);
|
||||
newObj[key] = truncateLongStrings(value, CONSOLE_JSON_LONG_STRING_LENGTH);
|
||||
} else {
|
||||
newObj[key] = truncateObject(value);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue