logsafe

package
v1.77.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package logsafe makes a caller-supplied string safe to put in a log line.

Index

Constants

View Source
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

func Bounded(v string, limit int) string

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

func Value(v string) string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL