summaryrefslogtreecommitdiff
path: root/fs/tailfile.go
diff options
context:
space:
mode:
Diffstat (limited to 'fs/tailfile.go')
-rw-r--r--fs/tailfile.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/fs/tailfile.go b/fs/tailfile.go
new file mode 100644
index 0000000..a19d4e6
--- /dev/null
+++ b/fs/tailfile.go
@@ -0,0 +1,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,
+ },
+ }
+}