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
28
29
30
31
32
|
package fs
// 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,
maxLineLength int) TailFile {
return TailFile{
readFile: readFile{
filePath: filePath,
globID: globID,
serverMessages: serverMessages,
retry: true,
canSkipLines: true,
seekEOF: true,
maxLineLength: maxLineLength,
},
}
}
// NewValidatedTailFile returns a new file tailer backed by a rooted open target.
func NewValidatedTailFile(filePath string, target ValidatedReadTarget, globID string,
serverMessages chan<- string, maxLineLength int) TailFile {
tail := NewTailFile(filePath, globID, serverMessages, maxLineLength)
tail.readFile.validatedTarget = &target
return tail
}
|