Skip to main content

truncate_for_log

Function truncate_for_log 

Source
pub fn truncate_for_log(s: &str) -> Cow<'_, str>
Expand description

Truncate a string for safe inclusion in log output.

Returns the original string if it fits within LOG_BODY_MAX_LEN, otherwise truncates at a UTF-8 boundary and appends ... [truncated].