hpcloud / tail

Go package for reading from continously updated files (tail -f)
MIT License
2.72k stars 505 forks source link

Support tailing -f only to read the new lines without reading the whole file first #119

Closed faizann closed 7 years ago

faizann commented 7 years ago

Tailing a file reads the whole file from start. We need a switch which will only read new lines after the start of tailing.

faizann commented 7 years ago

It was my mistake. The Seek allows to do so

seekInfo := tail.SeekInfo{Offset:0, Whence:os.SEEK_END}
t, err := tail.TailFile(myfilepath, tail.Config{Follow: true, Poll: true, ReOpen: true, Location: &seekInfo})