Back to godoc.org

Package limitbuf

v0.0.9
Latest Go to latest
Published: Jun 24, 2020 | License: Apache-2.0 | Module: github.com/grailbio/base

Index

Package Files

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.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier