summaryrefslogtreecommitdiff
path: root/fs/tailfile.go
blob: a19d4e6b63a20e266bd20e0001261766c1c943f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package fs

import "sync"

// TailFile is to tail and filter a log file.
type TailFile struct {
	readFile
}

// NewTailFile returns a new file tailer.
func NewTailFile(filePath string, globID string, serverMessages chan<- string, limiter chan struct{}) TailFile {
	var mutex sync.Mutex

	return TailFile{
		readFile: readFile{
			filePath:       filePath,
			stop:           make(chan struct{}),
			globID:         globID,
			serverMessages: serverMessages,
			retry:          true,
			canSkipLines:   true,
			seekEOF:        true,
			limiter:        limiter,
			mutex:          &mutex,
		},
	}
}