limitbuf

package
v0.0.1-really Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2019 License: Apache-2.0 Imports: 1 Imported by: 2 modules, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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