From 238dd3930e9c58397a86f649c77912ee32e4d7f0 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 4 Mar 2020 16:32:27 +0000 Subject: can tail probe with a given timeout and then write a mapreduce result --- internal/io/fs/readfile.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'internal/io/fs') diff --git a/internal/io/fs/readfile.go b/internal/io/fs/readfile.go index 321432e..cb16ec1 100644 --- a/internal/io/fs/readfile.go +++ b/internal/io/fs/readfile.go @@ -5,6 +5,7 @@ import ( "compress/gzip" "context" "errors" + "fmt" "io" "os" "regexp" @@ -39,6 +40,16 @@ type readFile struct { limiter chan struct{} } +// String returns the string representation of the readFile +func (f readFile) String() string { + return fmt.Sprintf("readFile(filePath:%s,globID:%s,retry:%v,canSkipLines:%v,seekEOF:%v)", + f.filePath, + f.globID, + f.retry, + f.canSkipLines, + f.seekEOF) +} + // FilePath returns the full file path. func (f readFile) FilePath() string { return f.filePath @@ -51,6 +62,7 @@ func (f readFile) Retry() bool { // Start tailing a log file. func (f readFile) Start(ctx context.Context, lines chan<- line.Line, regex string) error { + logger.Debug("readFile", f) defer func() { select { case <-f.limiter: -- cgit v1.2.3