limitbuf

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2020 License: Apache-2.0 Imports: 1 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger is like strings.Builder, but with maximum length. If the caller tries to add data beyond the capacity, they will be dropped, and Logger.String() will append "(truncated)" at the end.

func NewLogger

func NewLogger(maxLen int) *Logger

NewLogger creates a new Logger object with the given capacity.

func (*Logger) String

func (b *Logger) String() string

String reports the data written so far. If the length of the data exceeds the buffer capacity, the prefix of the data, plus "(truncated)" will be reported.

func (*Logger) Write

func (b *Logger) Write(data []byte) (int, error)

Write implements io.Writer interface.

Jump to

Keyboard shortcuts

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