Documentation ¶
Overview ¶
TODO: avoid creating two instances of the fsnotify.Watcher struct
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Location int // -n Follow bool // -f ReOpen bool // -F MustExist bool // if false, wait for the file to exist before beginning to tail. Poll bool // if true, do not use inotify but use polling MaxLineSize int // if > 0, limit the line size (rest of the line would be returned as next lines) }
type FileWatcher ¶
type InotifyFileWatcher ¶
type InotifyFileWatcher struct {
Filename string
}
FileWatcher monitors file-level events
func NewInotifyFileWatcher ¶
func NewInotifyFileWatcher(filename string) *InotifyFileWatcher
func (*InotifyFileWatcher) BlockUntilExists ¶
func (fw *InotifyFileWatcher) BlockUntilExists() error
BlockUntilExists blocks until the file comes into existence. If the file already exists, then block until it is created again.
func (*InotifyFileWatcher) ChangeEvents ¶
func (fw *InotifyFileWatcher) ChangeEvents() chan bool
ChangeEvents returns a channel that gets updated when the file is ready to be read.
type InotifyTracker ¶
type InotifyTracker struct {
// contains filtered or unexported fields
}
func NewInotifyTracker ¶
func NewInotifyTracker() *InotifyTracker
func (*InotifyTracker) CloseAll ¶
func (t *InotifyTracker) CloseAll()
func (*InotifyTracker) CloseWatcher ¶
func (t *InotifyTracker) CloseWatcher(w *fsnotify.Watcher) (err error)
func (*InotifyTracker) NewWatcher ¶
func (t *InotifyTracker) NewWatcher() (*fsnotify.Watcher, error)
type PollingFileWatcher ¶
type PollingFileWatcher struct {
Filename string
}
FileWatcher monitors file-level events
func NewPollingFileWatcher ¶
func NewPollingFileWatcher(filename string) *PollingFileWatcher
func (*PollingFileWatcher) BlockUntilExists ¶
func (fw *PollingFileWatcher) BlockUntilExists() error
BlockUntilExists blocks until the file comes into existence. If the file already exists, then block until it is created again.
func (*PollingFileWatcher) ChangeEvents ¶
func (fw *PollingFileWatcher) ChangeEvents() chan bool
ChangeEvents returns a channel that gets updated when the file is ready to be read.
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 channels the lines of a logfile along with timestamp. If end is true, channel only newly added lines. If retry is true, tail the file name (not descriptor) and retry on file open/read errors. func TailFile(filename string, maxlinesize int, end bool, retry bool, useinotify bool) (*Tail, error) {