Documentation
¶
Overview ¶
Package logsafe makes a caller-supplied string safe to put in a log line.
Index ¶
Constants ¶
const MaxValue = 256
MaxValue bounds a caller-supplied value in a log line, in bytes.
Variables ¶
This section is empty.
Functions ¶
func Bounded ¶ added in v1.77.0
Bounded is Value with a caller-chosen cap in bytes. Line breaks go first and by name, then every other control character; a cut that lands inside a multi-byte character drops the broken tail rather than logging it.
func Value ¶
Value is a caller-supplied string (a method name from the request, the transport's request id, the caller's subject) made safe to put in a log line: line breaks and other control characters are removed, so the value cannot start a forged line, and its length is bounded by MaxValue. An ordinary value is returned unchanged.
Types ¶
This section is empty.