tail

package module
v0.0.0-...-24ee71b Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2017 License: MIT Imports: 7 Imported by: 0

README

tail

The package is implemented using tail function provided by Linux. It simply reads the stdout of tail using bufio.Scanner and pass it to the application through a go channel.

LeKovr fork changes

Changed tail call arguments:

  • removed "-c +1"
  • "-F" used instead "-f"
  • added "-n" support (added argument to TailFile)

Also tests was simplified (takes 10 secs)

Documentation

Index

Constants

View Source
const (
	QUEUE_SIZE = 100 // size of channel
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Tail

type Tail struct {
	Filename string      // name of file to tail
	Lines    chan string // channel to read lines
	Err      error       // stores the error occurred
	// contains filtered or unexported fields
}

func TailFile

func TailFile(filepath, lines string, buffersize int) (*Tail, error)

begins tailing a linux file. Output stream is made available through `Tail.Lines` channel lines used with "-n" argument and may be prefixed with "+"

func (*Tail) Stop

func (t *Tail) Stop() error

stops tailing the file

func (*Tail) String

func (t *Tail) String() string

Jump to

Keyboard shortcuts

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