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.
The string to log.
Characters kept before the value is cut off. Default 10,000.
The value on one line, with …[truncated] appended when it was cut off.
…[truncated]
SanitizeForLog('bob\n[ERROR] forged'); // 'bob[ERROR] forged' Copy
SanitizeForLog('bob\n[ERROR] forged'); // 'bob[ERROR] forged'
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.