Documentation ¶
Index ¶
- Variables
- func CopyBytesToString(src []byte) (s string)
- func OpenFile(name string) (file *os.File, err error)
- type Config
- type Line
- type SeekInfo
- type Tail
- func (tail *Tail) AddLineBytes(value int64)
- func (tail *Tail) Cleanup()
- func (tail *Tail) NewLine(text string) *Line
- func (tail *Tail) Offset() (offset int64)
- func (tail *Tail) Order() (order uint64)
- func (tail *Tail) Stop() error
- func (tail *Tail) StopAtEOF() error
- func (tail *Tail) WaitIfOutOfMemory() bool
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultLogger is used when Config.Logger == nil DefaultLogger = log.New(os.Stderr, "", log.LstdFlags) // DiscardingLogger can be used to disable logging output DiscardingLogger = log.New(ioutil.Discard, "", 0) )
View Source
var (
ErrStop = errors.New("tail should now stop")
)
Functions ¶
func CopyBytesToString ¶ added in v1.1.0
Types ¶
type Config ¶
type Config struct { // File-specifc Location *SeekInfo // Seek to this location before tailing ReOpen bool // Reopen recreated files (tail -F) MustExist bool // Fail early if the file does not exist Poll bool // Poll for file changes instead of using inotify Pipe bool // Is a named pipe (mkfifo) // Generic IO ReadLimit int Follow bool // Continue looking for new lines (tail -f) MaxLineSize int64 // If non-zero, split longer lines into multiple lines LinesChannelLength int // Logger, when nil, is set to tail.DefaultLogger // To disable logging: set field to tail.DiscardingLogger Regex string Logger logger StartWithOrder uint64 }
Config is used to specify how a file must be tailed.
type Tail ¶
type Tail struct { Filename string Lines chan *Line Config tomb.Tomb // provides: Done, Kill, Dying // contains filtered or unexported fields }
func TailFile ¶
TailFile begins tailing the file. Output stream is made available via the `Tail.Lines` channel. To handle errors during tailing, invoke the `Wait` or `Err` method after finishing reading from the `Lines` channel.
func (*Tail) AddLineBytes ¶ added in v1.1.0
func (*Tail) Cleanup ¶
func (tail *Tail) Cleanup()
Cleanup removes inotify watches added by the tail package. This function is meant to be invoked from a process's exit handler. Linux kernel may not automatically remove inotify watches after the process exits.
Click to show internal directories.
Click to hide internal directories.