Member Junction
    Preparing search index...
    • Prepares a caller-supplied string for a log line: caps its length, then strips every CR and LF so the value cannot start a forged log entry.

      Parameters

      • value: string

        The string to log.

      • maxLength: number = 10_000

        Characters kept before the value is cut off. Default 10,000.

      Returns string

      The value on one line, with …[truncated] appended when it was cut off.

      SanitizeForLog('bob\n[ERROR] forged'); // 'bob[ERROR] forged'