base: Index | Files

package limitbuf

import ""


Package Files


type Logger Uses

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 Uses

func NewLogger(maxLen int) *Logger

NewLogger creates a new Logger object with the given capacity.

func (*Logger) String Uses

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 Uses

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

Write implements io.Writer interface.

Package limitbuf imports 1 packages (graph) and is imported by 5 packages. Updated 2019-07-03. Refresh now. Tools for package owners.