tailer

package
v0.0.0-...-9d78121 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2020 License: LGPL-3.0 Imports: 6 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SeekLastLines

func SeekLastLines(readSeeker io.ReadSeeker, lines uint, filter TailerFilterFunc) error

SeekLastLines sets the read position of the ReadSeeker to the wanted number of filtered lines before the end.

Types

type Tailer

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

Tailer reads an input line by line an tails them into the passed Writer. The lines have to be terminated with a newline.

func NewTailer

func NewTailer(readSeeker io.ReadSeeker, writer io.Writer, filter TailerFilterFunc) *Tailer

NewTailer starts a Tailer which reads strings from the passed ReadSeeker line by line. If a filter function is specified the read lines are filtered. The matching lines are written to the passed Writer.

func (*Tailer) Dead

func (t *Tailer) Dead() <-chan struct{}

Dead returns the channel that can be used to wait until the tailer is stopped.

func (*Tailer) Err

func (t *Tailer) Err() error

Err returns a possible error.

func (*Tailer) Stop

func (t *Tailer) Stop() error

Stop tells the tailer to stop working.

func (*Tailer) Wait

func (t *Tailer) Wait() error

Wait waits until the tailer is stopped due to command or an error. In case of an error it returns the reason.

type TailerFilterFunc

type TailerFilterFunc func(line []byte) bool

TailerFilterFunc decides if a line shall be tailed (func is nil or returns true) of shall be omitted (func returns false).

Jump to

Keyboard shortcuts

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