Help us shape the future of Go! Take the 2026 Go Developer Survey

truncate

package
v1.28.0 Latest Latest
Warning

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

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

Documentation

Overview

Package truncate shortens long values before they are logged or printed, marking where they were cut.

Index

Constants

View Source
const (
	// MaxLogLength is the maximum length for log output to prevent log bloat
	MaxLogLength = 200
	// MaxLength is the maximum length for general string processing
	MaxLength = 1000000
)

Variables

This section is empty.

Functions

func Map

func Map(params map[string]any, maxLen int) map[string]any

Map truncates long values in map[string]any for logging

func MapString

func MapString(params map[string]string, maxLen int) map[string]string

MapString truncates long values in map[string]string for logging

func Message

func Message() string

Message returns the colored marker appended to a truncated value.

func String

func String(s string, maxLen int) string

String truncates a string if it exceeds the maximum length

Types

This section is empty.

Jump to

Keyboard shortcuts

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