Documentation
¶
Overview ¶
Package truncate shortens long values before they are logged or printed, marking where they were cut.
Index ¶
Constants ¶
const MaxLogLength = 200
MaxLogLength is the maximum length for log output to prevent log bloat
Variables ¶
This section is empty.
Functions ¶
func Message ¶
func Message() string
Message returns the colored marker appended to a truncated value.
func String ¶
String cuts s to at most maxLen bytes and appends Message when s is longer. The cut backs off to the start of a rune, so a multibyte character, such as one of Japanese text, is never split in two. It backs off no further than a rune can be long: past that the bytes are not UTF-8, and they are cut where maxLen falls rather than all left out.
func Value ¶
Value truncates the long strings in v, a value an action logs, at any depth, keeping its maps and lists as they are laid out, so that what logs it shows them as such. A map comes back as a map[string]any and a list as a []any, other than a []byte, which is left as it is, as are numbers and booleans. Any other value, such as a struct, is turned into a string and truncated.
Types ¶
This section is empty.