linebuffer

package
v0.0.0-...-b3777ea Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: MIT, MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fn

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

Fn calls function for each line written

func NewFn

func NewFn(fn func(line string)) *Fn

NewFn create new buffer that calls function foreach line written

func (*Fn) Close

func (fn *Fn) Close() error

Close flushes any data left in the buffer as a line

func (*Fn) Write

func (fn *Fn) Write(p []byte) (n int, err error)

type LastLines

type LastLines struct {
	Fn
	// contains filtered or unexported fields
}

LastLines buffers the last n lines

func NewLastLines

func NewLastLines(limit int) *LastLines

NewLastLines creates a new limited line buffer that buffers the last n lines

func (*LastLines) Bytes

func (lb *LastLines) Bytes() []byte

Bytes returns last n lines as bytes

func (*LastLines) String

func (lb *LastLines) String() string

String returns last n lines as a string

Jump to

Keyboard shortcuts

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